Skip to content

Commit dd8a55b

Browse files
come-ncbackportbot[bot]
authored andcommitted
fix: Add missing Attribute and fix parameter type in renewpassword route
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
1 parent c5ecd11 commit dd8a55b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/user_ldap/lib/Controller/RenewPasswordController.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright Copyright (c) 2017 Roger Szabo <roger.szabo@web.de>
45
*
@@ -120,6 +121,7 @@ public function showRenewPasswordForm($user) {
120121
/**
121122
* @PublicPage
122123
* @UseSession
124+
* @BruteForceProtection(action=login)
123125
*
124126
* @param string $user
125127
* @param string $oldPassword
@@ -131,19 +133,21 @@ public function tryRenewPassword($user, $oldPassword, $newPassword) {
131133
if ($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
132134
return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
133135
}
134-
$args = !is_null($user) ? ['user' => $user] : [];
136+
$args = ['user' => $user];
135137
$loginResult = $this->userManager->checkPassword($user, $oldPassword);
136138
if ($loginResult === false) {
137139
$this->session->set('renewPasswordMessages', [
138140
['invalidpassword'], []
139141
]);
140-
return new RedirectResponse($this->urlGenerator->linkToRoute('user_ldap.renewPassword.showRenewPasswordForm', $args));
142+
$response = new RedirectResponse($this->urlGenerator->linkToRoute('user_ldap.renewPassword.showRenewPasswordForm', $args));
143+
$response->throttle(['user' => $user]);
144+
return $response;
141145
}
142146

143147
try {
144148
if (!is_null($newPassword) && \OC_User::setPassword($user, $newPassword)) {
145149
$this->session->set('loginMessages', [
146-
[], [$this->l10n->t("Please login with the new password")]
150+
[], [$this->l10n->t('Please login with the new password')]
147151
]);
148152
$this->config->setUserValue($user, 'user_ldap', 'needsPasswordReset', 'false');
149153
return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args));

0 commit comments

Comments
 (0)