aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2023-04-13 18:05:37 +0200
committerLouis Chemineau <louis@chmn.me>2023-04-13 18:05:37 +0200
commitfec8ad8441484bc4da70729ea911d420fc8fb7a6 (patch)
treec3cb5ea9dd6192f6d4f05d841e982e49d094e139
parentb3f59aa4c1c029fa601cc6152f04b81fd00b5dc5 (diff)
downloadnextcloud-server-fec8ad8441484bc4da70729ea911d420fc8fb7a6.tar.gz
nextcloud-server-fec8ad8441484bc4da70729ea911d420fc8fb7a6.zip
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>
-rw-r--r--apps/files_external/lib/Listener/StorePasswordListener.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/files_external/lib/Listener/StorePasswordListener.php b/apps/files_external/lib/Listener/StorePasswordListener.php
index 66232a78a93..f5820eff52c 100644
--- a/apps/files_external/lib/Listener/StorePasswordListener.php
+++ b/apps/files_external/lib/Listener/StorePasswordListener.php
@@ -59,12 +59,12 @@ class StorePasswordListener implements IEventListener {
$newCredentials = $storedCredentials;
$shouldUpdate = false;
- if (isset($storedCredentials['password']) && $storedCredentials['password'] !== $event->getPassword()) {
+ if (($storedCredentials['password'] ?? null) !== $event->getPassword() && $event->getPassword() !== null) {
$shouldUpdate = true;
$newCredentials['password'] = $event->getPassword();
}
- if (isset($storedCredentials['user']) && $event instanceof UserLoggedInEvent && $storedCredentials['user'] !== $event->getLoginName()) {
+ if ($event instanceof UserLoggedInEvent && ($storedCredentials['user'] ?? null) !== $event->getLoginName()) {
$shouldUpdate = true;
$newCredentials['user'] = $event->getLoginName();
}