diff options
author | Thomas Citharel <tcit@tcit.fr> | 2020-04-10 18:05:43 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2020-04-10 18:05:43 +0200 |
commit | 18e8af4bb838af18eb68111c4d35dd1c68d0a963 (patch) | |
tree | d1745beed1486a7de9f7140083acf5d34a4df622 /apps/settings/lib/Hooks.php | |
parent | 1762a409f954fd9a66e7572704ea9ba7813601b4 (diff) | |
download | nextcloud-server-18e8af4bb838af18eb68111c4d35dd1c68d0a963.tar.gz nextcloud-server-18e8af4bb838af18eb68111c4d35dd1c68d0a963.zip |
Fix password reset saying Admin changed my password when reset from
login page
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/settings/lib/Hooks.php')
-rw-r--r-- | apps/settings/lib/Hooks.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/settings/lib/Hooks.php b/apps/settings/lib/Hooks.php index 851f2f143dc..e4e86e278c1 100644 --- a/apps/settings/lib/Hooks.php +++ b/apps/settings/lib/Hooks.php @@ -106,6 +106,7 @@ class Hooks { $actor = $this->userSession->getUser(); if ($actor instanceof IUser) { if ($actor->getUID() !== $user->getUID()) { + // Admin changed the password through the user panel $this->l = $this->languageFactory->get( 'settings', $this->config->getUserValue( @@ -118,13 +119,21 @@ class Hooks { $event->setAuthor($actor->getUID()) ->setSubject(Provider::PASSWORD_CHANGED_BY, [$actor->getUID()]); } else { + // User changed their password themselves through settings $text = $this->l->t('Your password on %s was changed.', [$instanceUrl]); $event->setAuthor($actor->getUID()) ->setSubject(Provider::PASSWORD_CHANGED_SELF); } } else { - $text = $this->l->t('Your password on %s was reset by an administrator.', [$instanceUrl]); - $event->setSubject(Provider::PASSWORD_RESET); + if (PHP_SAPI === 'cli') { + // Admin used occ to reset the password + $text = $this->l->t('Your password on %s was reset by an administrator.', [$instanceUrl]); + $event->setSubject(Provider::PASSWORD_RESET); + } else { + // User reset their password from Lost page + $text = $this->l->t('Your password on %s was reset.', [$instanceUrl]); + $event->setSubject(Provider::PASSWORD_RESET_SELF); + } } $this->activityManager->publish($event); |