Skip to content

Commit 0a5b3d0

Browse files
Merge pull request #35977 from nextcloud/backport/35965/stable25
[stable25] Also limit the password length on reset
2 parents 6683cfa + 151723b commit 0a5b3d0

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/Controller/LoginController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function logout() {
118118

119119
$response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute(
120120
'core.login.showLoginForm',
121-
['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers
121+
['clear' => true] // this param the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers
122122
));
123123

124124
$this->session->set('clearingExecutionContexts', '1');

core/Controller/LostController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ public function setPassword(string $token, string $userId, string $password, boo
240240
$this->eventDispatcher->dispatchTyped(new BeforePasswordResetEvent($user, $password));
241241
\OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'pre_passwordReset', ['uid' => $userId, 'password' => $password]);
242242

243+
if (strlen($password) > 469) {
244+
throw new HintException('Password too long', $this->l10n->t('Password is too long. Maximum allowed length is 469 characters.'));
245+
}
246+
243247
if (!$user->setPassword($password)) {
244248
throw new Exception();
245249
}

0 commit comments

Comments
 (0)