summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-08-18 13:03:40 +0200
committerJoas Schilling <coding@schilljs.com>2017-08-18 13:21:53 +0200
commitd5c6d56170aa4432db930a92436b7c997d5003fd (patch)
tree6bf8789074378123d37d3139775b772c2923dfbc /core/Controller
parent231cffffb9084ed1b7779f40ec07ad617ec71a30 (diff)
downloadnextcloud-server-d5c6d56170aa4432db930a92436b7c997d5003fd.tar.gz
nextcloud-server-d5c6d56170aa4432db930a92436b7c997d5003fd.zip
No password reset for disabled users
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/LostController.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php
index 59a4e0b2534..d23a6c2970d 100644
--- a/core/Controller/LostController.php
+++ b/core/Controller/LostController.php
@@ -167,7 +167,7 @@ class LostController extends Controller {
*/
protected function checkPasswordResetToken($token, $userId) {
$user = $this->userManager->get($userId);
- if($user === null) {
+ if($user === null || !$user->isEnabled()) {
throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
}
@@ -340,16 +340,25 @@ class LostController extends Controller {
/**
* @param string $input
* @return IUser
- * @throws \Exception
+ * @throws \InvalidArgumentException
*/
protected function findUserByIdOrMail($input) {
$user = $this->userManager->get($input);
if ($user instanceof IUser) {
+ if (!$user->isEnabled()) {
+ throw new \InvalidArgumentException($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.'));
+ }
+
return $user;
}
$users = $this->userManager->getByEmail($input);
if (count($users) === 1) {
- return $users[0];
+ $user = $users[0];
+ if (!$user->isEnabled()) {
+ throw new \InvalidArgumentException($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.'));
+ }
+
+ return $user;
}
throw new \InvalidArgumentException($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.'));