mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Fix AccountForm validation & Add repeated form
This commit is contained in:
@@ -93,18 +93,13 @@ class Account implements ControllerProviderInterface
|
||||
$data = $form->getData();
|
||||
|
||||
$password = $data['password'];
|
||||
$passwordConfirm = $data['passwordConfirm'];
|
||||
|
||||
$user = $app['authentication']->getUser();
|
||||
|
||||
if ($password !== $passwordConfirm) {
|
||||
$app->addFlash('error', _('forms::les mots de passe ne correspondent pas'));
|
||||
} elseif (strlen(trim($password)) < 5) {
|
||||
$app->addFlash('error', _('forms::la valeur donnee est trop courte'));
|
||||
} elseif (trim($password) != str_replace(array("\r\n", "\n", "\r", "\t", " "), "_", $password)) {
|
||||
if (trim($password) != str_replace(array("\r\n", "\n", "\r", "\t", " "), "_", $password)) {
|
||||
$app->addFlash('error', _('forms::la valeur donnee contient des caracteres invalides'));
|
||||
} elseif ($app['auth.password-encoder']->isPasswordValid($user->get_password(), $data['oldPassword'], $user->get_nonce())) {
|
||||
$user->set_password($passwordConfirm);
|
||||
$user->set_password($password);
|
||||
$app->addFlash('success', _('login::notification: Mise a jour du mot de passe avec succes'));
|
||||
|
||||
return $app->redirectPath('account');
|
||||
|
Reference in New Issue
Block a user