Skip to content

Commit 1399e74

Browse files
committed
Do not override stored credentials when login in with SAML
When login in with SAML, the password from `$event->getPassword()` is `null`. This PR makes sure that this `null` value won't be used to override the stored password even though it is different. This PR also allow for the password and user to be updated even though they were not set before. Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent 9409d19 commit 1399e74

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/files_external/lib/Listener/StorePasswordListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ public function handle(Event $event): void {
5959
$newCredentials = $storedCredentials;
6060
$shouldUpdate = false;
6161

62-
if (isset($storedCredentials['password']) && $storedCredentials['password'] !== $event->getPassword()) {
62+
if (($storedCredentials['password'] ?? null) !== $event->getPassword() && $event->getPassword() !== null) {
6363
$shouldUpdate = true;
6464
$newCredentials['password'] = $event->getPassword();
6565
}
6666

67-
if (isset($storedCredentials['user']) && $event instanceof UserLoggedInEvent && $storedCredentials['user'] !== $event->getLoginName()) {
67+
if ($event instanceof UserLoggedInEvent && ($storedCredentials['user'] ?? null) !== $event->getLoginName()) {
6868
$shouldUpdate = true;
6969
$newCredentials['user'] = $event->getLoginName();
7070
}

0 commit comments

Comments
 (0)