Skip to content

Commit 68a923d

Browse files
susnuxcome-nc
andcommitted
fix: Move login via email logic to local backend
Backends can decide which names they accept for login, e.g. with user_ldap you can configure arbitrary login fields. This was a hacky approach to allow login via email, so instead this is now only handled by the local user backend. This also fixes some other related problems: Other logic relys on `backend::get()` which was not handling email, so e.g. password policy could not block users logged in via email if they use out-dated passwords. Similar for other integrations, as the user backend was not consistent with what is a login name and what not. Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de> Co-authored-by: Côme Chilliet <91878298+come-nc@users.noreply.github.com> Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 8bc5ec1 commit 68a923d

File tree

6 files changed

+138
-332
lines changed

6 files changed

+138
-332
lines changed

lib/composer/composer/autoload_classmap.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,6 @@
10771077
'OC\\Authentication\\Login\\ClearLostPasswordTokensCommand' => $baseDir . '/lib/private/Authentication/Login/ClearLostPasswordTokensCommand.php',
10781078
'OC\\Authentication\\Login\\CompleteLoginCommand' => $baseDir . '/lib/private/Authentication/Login/CompleteLoginCommand.php',
10791079
'OC\\Authentication\\Login\\CreateSessionTokenCommand' => $baseDir . '/lib/private/Authentication/Login/CreateSessionTokenCommand.php',
1080-
'OC\\Authentication\\Login\\EmailLoginCommand' => $baseDir . '/lib/private/Authentication/Login/EmailLoginCommand.php',
10811080
'OC\\Authentication\\Login\\FinishRememberedLoginCommand' => $baseDir . '/lib/private/Authentication/Login/FinishRememberedLoginCommand.php',
10821081
'OC\\Authentication\\Login\\LoggedInCheckCommand' => $baseDir . '/lib/private/Authentication/Login/LoggedInCheckCommand.php',
10831082
'OC\\Authentication\\Login\\LoginData' => $baseDir . '/lib/private/Authentication/Login/LoginData.php',

lib/composer/composer/autoload_static.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
11261126
'OC\\Authentication\\Login\\ClearLostPasswordTokensCommand' => __DIR__ . '/../../..' . '/lib/private/Authentication/Login/ClearLostPasswordTokensCommand.php',
11271127
'OC\\Authentication\\Login\\CompleteLoginCommand' => __DIR__ . '/../../..' . '/lib/private/Authentication/Login/CompleteLoginCommand.php',
11281128
'OC\\Authentication\\Login\\CreateSessionTokenCommand' => __DIR__ . '/../../..' . '/lib/private/Authentication/Login/CreateSessionTokenCommand.php',
1129-
'OC\\Authentication\\Login\\EmailLoginCommand' => __DIR__ . '/../../..' . '/lib/private/Authentication/Login/EmailLoginCommand.php',
11301129
'OC\\Authentication\\Login\\FinishRememberedLoginCommand' => __DIR__ . '/../../..' . '/lib/private/Authentication/Login/FinishRememberedLoginCommand.php',
11311130
'OC\\Authentication\\Login\\LoggedInCheckCommand' => __DIR__ . '/../../..' . '/lib/private/Authentication/Login/LoggedInCheckCommand.php',
11321131
'OC\\Authentication\\Login\\LoginData' => __DIR__ . '/../../..' . '/lib/private/Authentication/Login/LoginData.php',

lib/private/Authentication/Login/Chain.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ class Chain {
1818
/** @var UidLoginCommand */
1919
private $uidLoginCommand;
2020

21-
/** @var EmailLoginCommand */
22-
private $emailLoginCommand;
23-
2421
/** @var LoggedInCheckCommand */
2522
private $loggedInCheckCommand;
2623

@@ -48,7 +45,6 @@ class Chain {
4845
public function __construct(PreLoginHookCommand $preLoginHookCommand,
4946
UserDisabledCheckCommand $userDisabledCheckCommand,
5047
UidLoginCommand $uidLoginCommand,
51-
EmailLoginCommand $emailLoginCommand,
5248
LoggedInCheckCommand $loggedInCheckCommand,
5349
CompleteLoginCommand $completeLoginCommand,
5450
CreateSessionTokenCommand $createSessionTokenCommand,
@@ -61,7 +57,6 @@ public function __construct(PreLoginHookCommand $preLoginHookCommand,
6157
$this->preLoginHookCommand = $preLoginHookCommand;
6258
$this->userDisabledCheckCommand = $userDisabledCheckCommand;
6359
$this->uidLoginCommand = $uidLoginCommand;
64-
$this->emailLoginCommand = $emailLoginCommand;
6560
$this->loggedInCheckCommand = $loggedInCheckCommand;
6661
$this->completeLoginCommand = $completeLoginCommand;
6762
$this->createSessionTokenCommand = $createSessionTokenCommand;
@@ -77,7 +72,6 @@ public function process(LoginData $loginData): LoginResult {
7772
$chain
7873
->setNext($this->userDisabledCheckCommand)
7974
->setNext($this->uidLoginCommand)
80-
->setNext($this->emailLoginCommand)
8175
->setNext($this->loggedInCheckCommand)
8276
->setNext($this->completeLoginCommand)
8377
->setNext($this->createSessionTokenCommand)

lib/private/Authentication/Login/EmailLoginCommand.php

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)