fix: Add missing Attribute and fix parameter type in renewpassword route

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/59073/head
Côme Chilliet 2 months ago committed by backportbot[bot]
parent 9fbb26e222
commit fdb20a036d
  1. 10
      apps/user_ldap/lib/Controller/RenewPasswordController.php

@ -1,4 +1,5 @@
<?php
/**
* @copyright Copyright (c) 2017 Roger Szabo <roger.szabo@web.de>
*
@ -120,6 +121,7 @@ class RenewPasswordController extends Controller {
/**
* @PublicPage
* @UseSession
* @BruteForceProtection(action=login)
*
* @param string $user
* @param string $oldPassword
@ -131,19 +133,21 @@ class RenewPasswordController extends Controller {
if ($this->config->getUserValue($user, 'user_ldap', 'needsPasswordReset') !== 'true') {
return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
}
$args = !is_null($user) ? ['user' => $user] : [];
$args = ['user' => $user];
$loginResult = $this->userManager->checkPassword($user, $oldPassword);
if ($loginResult === false) {
$this->session->set('renewPasswordMessages', [
['invalidpassword'], []
]);
return new RedirectResponse($this->urlGenerator->linkToRoute('user_ldap.renewPassword.showRenewPasswordForm', $args));
$response = new RedirectResponse($this->urlGenerator->linkToRoute('user_ldap.renewPassword.showRenewPasswordForm', $args));
$response->throttle(['user' => $user]);
return $response;
}
try {
if (!is_null($newPassword) && \OC_User::setPassword($user, $newPassword)) {
$this->session->set('loginMessages', [
[], [$this->l10n->t("Please login with the new password")]
[], [$this->l10n->t('Please login with the new password')]
]);
$this->config->setUserValue($user, 'user_ldap', 'needsPasswordReset', 'false');
return new RedirectResponse($this->urlGenerator->linkToRoute('core.login.showLoginForm', $args));

Loading…
Cancel
Save