diff --git a/lib/Alchemy/Phrasea/Application/Root.php b/lib/Alchemy/Phrasea/Application/Root.php index bb7b82c45f..11ae964ddf 100644 --- a/lib/Alchemy/Phrasea/Application/Root.php +++ b/lib/Alchemy/Phrasea/Application/Root.php @@ -123,9 +123,12 @@ return call_user_func(function($environment = null) { } elseif ($e instanceof \Exception_NotFound) { $code = 404; $message = 'Not Found'; + } elseif($e instanceof \Exception_UnauthorizedAction) { + $code = 403; + $message = 'Forbidden'; } else { $code = 500; - $message = 'Server Error'; + $message = 'Server Error' . ($app['debug'] ? ' : ' . $e->getMessage() : ''); } return new Response($message, $code, array('X-Status-Code' => $code)); diff --git a/lib/Alchemy/Phrasea/Controller/Root/Account.php b/lib/Alchemy/Phrasea/Controller/Root/Account.php index 83fad2d75a..4385bf3d83 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Account.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Account.php @@ -11,12 +11,13 @@ namespace Alchemy\Phrasea\Controller\Root; -use Silex\Application; -use Silex\ControllerProviderInterface; +use Alchemy\Phrasea\Application as PhraseaApplication; use Alchemy\Phrasea\Exception\InvalidArgumentException; use Alchemy\Phrasea\Notification\Receiver; use Alchemy\Phrasea\Notification\Mail\MailRequestEmailUpdate; use Alchemy\Phrasea\Form\Login\PhraseaRenewPasswordForm; +use Silex\Application; +use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RedirectResponse; @@ -226,9 +227,11 @@ class Account implements ControllerProviderInterface if ('POST' === $request->getMethod()) { $form->bind($request); - if($form->isValid()) { - $password = $request->request->get('password'); - $passwordConfirm = $request->request->get('passwordConfirm'); + if ($form->isValid()) { + $data = $form->getData(); + + $password = $data['password']; + $passwordConfirm = $data['passwordConfirm']; $user = $app['authentication']->getUser(); @@ -238,19 +241,17 @@ class Account implements ControllerProviderInterface $app->addFlash('error', _('forms::la valeur donnee est trop courte')); } elseif (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(), $request->request->get('oldPassword'), $user->get_nonce())) { + } elseif ($app['auth.password-encoder']->isPasswordValid($user->get_password(), $data['oldPassword'], $user->get_nonce())) { $user->set_password($passwordConfirm); $app->addFlash('success', _('login::notification: Mise a jour du mot de passe avec succes')); return $app->redirect($app->path('account')); } else { - $app->addFlash('error', _('Password update failed')); + $app->addFlash('error', _('Invalid password provided')); } - - return $app->redirect($app->path('reset_password')); } } - return $app['twig']->render('login/change-password.html.twig', array( + return $app['twig']->render('account/change-password.html.twig', array( 'form' => $form->createView(), 'login' => new \login(), )); @@ -263,21 +264,8 @@ class Account implements ControllerProviderInterface * @param Request $request * @return RedirectResponse */ - public function resetEmail(Application $app, Request $request) + public function resetEmail(PhraseaApplication $app, Request $request) { - if (null !== $token = $request->request->get('token')) { - try { - $datas = $app['tokens']->helloToken($token); - $user = \User_Adapter::getInstance((int) $datas['usr_id'], $app); - $user->set_email($datas['datas']); - $app['tokens']->removeToken($token); - - return $app->redirect('/account/reset-email/?update=ok'); - } catch (\Exception $e) { - return $app->redirect('/account/reset-email/?update=ko'); - } - } - if (null === ($password = $request->request->get('form_password')) || null === ($email = $request->request->get('form_email')) || null === ($emailConfirm = $request->request->get('form_email_confirm'))) { @@ -287,16 +275,22 @@ class Account implements ControllerProviderInterface $user = $app['authentication']->getUser(); - if ($app['auth.password-encoder']->isPasswordValid($user->get_password(), $password, $user->get_nonce())) { - return $app->redirect('/account/reset-email/?notice=bad-password'); + if (!$app['auth.password-encoder']->isPasswordValid($user->get_password(), $password, $user->get_nonce())) { + $app->addFlash('error', _('admin::compte-utilisateur:ftp: Le mot de passe est errone')); + + return $app->redirect($app->path('account_reset_email')); } if (!\Swift_Validate::email($email)) { - return $app->redirect('/account/reset-email/?notice=mail-invalid'); + $app->addFlash('error', _('forms::l\'email semble invalide')); + + return $app->redirect($app->path('account_reset_email')); } if ($email !== $emailConfirm) { - return $app->redirect('/account/reset-email/?notice=mail-match'); + $app->addFlash('error', _('forms::les emails ne correspondent pas')); + + return $app->redirect($app->path('account_reset_email')); } $date = new \DateTime('1 day'); @@ -306,7 +300,9 @@ class Account implements ControllerProviderInterface try { $receiver = Receiver::fromUser($app['authentication']->getUser()); } catch (InvalidArgumentException $e) { - return $app->redirect('/account/reset-email/?notice=mail-not-send'); + $app->addFlash('error', _('phraseanet::erreur: echec du serveur de mail')); + + return $app->redirect($app->path('account_reset_email')); } $mail = MailRequestEmailUpdate::create($app, $receiver, null); @@ -315,7 +311,9 @@ class Account implements ControllerProviderInterface $app['notification.deliverer']->deliver($mail); - return $app->redirect('/account/reset-email/?update=mail-send'); + $app->addFlash('info', _('admin::compte-utilisateur un email de confirmation vient de vous etre envoye. Veuillez suivre les instructions contenue pour continuer')); + + return $app->redirect($app->path('account')); } /** @@ -327,41 +325,24 @@ class Account implements ControllerProviderInterface */ public function displayResetEmailForm(Application $app, Request $request) { - if (null !== $noticeMsg = $request->query->get('notice')) { - switch ($noticeMsg) { - case 'mail-server': - $noticeMsg = _('phraseanet::erreur: echec du serveur de mail'); - break; - case 'mail-match': - $noticeMsg = _('forms::les emails ne correspondent pas'); - break; - case 'mail-invalid': - $noticeMsg = _('forms::l\'email semble invalide'); - break; - case 'bad-password': - $noticeMsg = _('admin::compte-utilisateur:ftp: Le mot de passe est errone'); - break; + if (null !== $token = $request->query->get('token')) { + try { + $datas = $app['tokens']->helloToken($token); + $user = \User_Adapter::getInstance((int) $datas['usr_id'], $app); + $user->set_email($datas['datas']); + $app['tokens']->removeToken($token); + + $app->addFlash('success', _('admin::compte-utilisateur: L\'email a correctement ete mis a jour')); + + return $app->redirect($app->path('account')); + } catch (\Exception $e) { + $app->addFlash('error', _('admin::compte-utilisateur: erreur lors de la mise a jour')); + + return $app->redirect($app->path('account')); } } - if (null !== $updateMsg = $request->query->get('update')) { - switch ($updateMsg) { - case 'ok': - $updateMsg = _('admin::compte-utilisateur: L\'email a correctement ete mis a jour'); - break; - case 'ko': - $updateMsg = _('admin::compte-utilisateur: erreur lors de la mise a jour'); - break; - case 'mail-send': - $updateMsg = _('admin::compte-utilisateur un email de confirmation vient de vous etre envoye. Veuillez suivre les instructions contenue pour continuer'); - break; - } - } - - return $app['twig']->render('account/reset-email.html.twig', array( - 'noticeMsg' => $noticeMsg, - 'updateMsg' => $updateMsg, - )); + return $app['twig']->render('account/reset-email.html.twig'); } /** @@ -455,27 +436,8 @@ class Account implements ControllerProviderInterface */ public function displayAccount(Application $app, Request $request) { - switch ($notice = $request->query->get('notice', '')) { - case 'pass-ok': - $notice = _('login::notification: Mise a jour du mot de passe avec succes'); - break; - case 'pass-ko': - $notice = _('Password update failed'); - break; - case 'account-update-ok': - $notice = _('login::notification: Changements enregistres'); - break; - case 'account-update-bad': - $notice = _('forms::erreurs lors de l\'enregistrement des modifications'); - break; - case 'demand-ok': - $notice = _('login::notification: Vos demandes ont ete prises en compte'); - break; - } - return $app['twig']->render('account/account.html.twig', array( 'user' => $app['authentication']->getUser(), - 'notice' => $notice, 'evt_mngr' => $app['events-manager'], 'notifications' => $app['events-manager']->list_notifications_available($app['authentication']->getUser()->get_id()), )); @@ -484,14 +446,12 @@ class Account implements ControllerProviderInterface /** * Update account informations * - * @param Application $app A Silex application where the controller is mounted on + * @param PhraseaApplication $app A Silex application where the controller is mounted on * @param Request $request The current request * @return Response */ - public function updateAccount(Application $app, Request $request) + public function updateAccount(PhraseaApplication $app, Request $request) { - $notice = 'account-update-bad'; - $demands = (array) $request->request->get('demand', array()); if (0 !== count($demands)) { @@ -500,7 +460,7 @@ class Account implements ControllerProviderInterface foreach ($demands as $baseId) { try { $register->add_request($app['authentication']->getUser(), \collection::get_from_base_id($app, $baseId)); - $notice = 'demand-ok'; + $app->addFlash('success', _('login::notification: Vos demandes ont ete prises en compte')); } catch (\Exception $e) { } @@ -523,7 +483,8 @@ class Account implements ControllerProviderInterface 'form_loginFTP', 'form_pwdFTP', 'form_destFTP', - 'form_prefixFTPfolder' + 'form_prefixFTPfolder', + 'form_retryFTP' ); if (0 === count(array_diff($accountFields, array_keys($request->request->all())))) { @@ -567,10 +528,10 @@ class Account implements ControllerProviderInterface ->set_ftp_dir_prefix($request->request->get("form_prefixFTPfolder")) ->set_defaultftpdatas($defaultDatas); + $app->addFlash('success', _('login::notification: Changements enregistres')); $app['phraseanet.appbox']->get_connection()->commit(); - - $notice = 'account-update-ok'; } catch (Exception $e) { + $app->addFlash('error', _('forms::erreurs lors de l\'enregistrement des modifications')); $app['phraseanet.appbox']->get_connection()->rollBack(); } } @@ -590,7 +551,7 @@ class Account implements ControllerProviderInterface } } - return $app->redirect(sprintf('/account/?notice=%s', $notice), 201); + return $app->redirect($app->path('account')); } /** diff --git a/lib/classes/User/Adapter.php b/lib/classes/User/Adapter.php index c62af33b4d..071bc23f77 100644 --- a/lib/classes/User/Adapter.php +++ b/lib/classes/User/Adapter.php @@ -409,6 +409,8 @@ class User_Adapter implements User_Interface, cache_cacheableInterface $stmt->execute(array(':password' => $password, ':usr_id' => $this->get_id())); $stmt->closeCursor(); + $this->password = $password; + return $this; } diff --git a/templates/web/account/account.html.twig b/templates/web/account/account.html.twig index 3bbe4a19f8..fe5607417f 100644 --- a/templates/web/account/account.html.twig +++ b/templates/web/account/account.html.twig @@ -1,6 +1,6 @@ {% extends "account/base.html.twig" %} -{% import "login/common/macros.html.twig" as auth_macro %} +{% import "common/macros.html.twig" as auth_macro %} {% set selected = "informations" %} @@ -20,10 +20,6 @@ {% block content %}
- {% if notice | trim != "" %} -
{{ notice }}
- {% endif %} - {{ auth_macro.flashes() }}
@@ -40,7 +36,7 @@
- diff --git a/templates/web/login/change-password.html.twig b/templates/web/account/change-password.html.twig similarity index 96% rename from templates/web/login/change-password.html.twig rename to templates/web/account/change-password.html.twig index c02d2943ca..510acdcf20 100644 --- a/templates/web/login/change-password.html.twig +++ b/templates/web/account/change-password.html.twig @@ -1,5 +1,6 @@ {% extends "login/layout/sidebar-layout.html.twig" %} +{% import "common/macros.html.twig" as account_macro %} {% import "login/common/macros.html.twig" as auth_macro %} {% block title %} @@ -17,7 +18,7 @@
- {{ auth_macro.flashes() }} + {{ account_macro.flashes() }} -
{{ updateMsg }}
- {% trans "admin::compte-utilisateur retour a mon compte"%} -
- {% else %} - - {% if noticeMsg is not none %} -
- {% trans "phraseanet::erreur : oups ! une erreur est survenue pendant l\'operation !" %} -
-
- {{ noticeMsg }} -
- {% trans "admin::compte-utilisateur retour a mon compte" %} - {% endif %} - - -
- -
-

{{ app["authentication"].getUser().get_login() }}

-

+
+
+ {{ auth_macro.flashes() }} + +
+ +
+

{{ app["authentication"].getUser().get_login() }}

+

+
+
+
+ +
+ + {#

#} +
+
+
+ +
+ + {#

#} +
+
+
+ +
+ + {#

#} +
+
+
+ + +
+ +
+ {% trans "admin::compte-utilisateur: Pourquoi me demande-t-on mon mot de passe pour changer mon adresse email ?"%} +
+ {% trans "admin::compte-utilisateur: Votre adresse e-mail sera utilisee lors de la perte de votre mot de passe afin de pouvoir le reinitialiser, il est important que vous soyez la seule personne a pouvoir la changer."%}
-
- -
- - {#

#} -
-
-
- -
- - {#

#} -
-
-
- -
- - {#

#} -
-
-
- - -
- -
- {% trans "admin::compte-utilisateur: Pourquoi me demande-t-on mon mot de passe pour changer mon adresse email ?"%} -
- {% trans "admin::compte-utilisateur: Votre adresse e-mail sera utilisee lors de la perte de votre mot de passe afin de pouvoir le reinitialiser, il est important que vous soyez la seule personne a pouvoir la changer."%}
-{% endif %} {% endblock %} diff --git a/templates/web/common/macros.html.twig b/templates/web/common/macros.html.twig index 6eebb1cd11..e672d41e0d 100644 --- a/templates/web/common/macros.html.twig +++ b/templates/web/common/macros.html.twig @@ -59,3 +59,23 @@ {% endmacro %} + +{% macro flashes() %} + {% for type in ["warning", "info", "success", "error"] %} + {% for message in app.getFlash(type) %} +
+ + + + + + +
{{ message }} + × +
+
+ {% endfor %} + {% endfor %} +{% endmacro %} \ No newline at end of file diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php index e5fff78df4..b00e452f00 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php @@ -48,30 +48,18 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract } /** - * @dataProvider msgProvider + * @dataProvider noticeProvider */ - public function testGetAccountNotice($msg) + public function testGetAccountNotice($type, $message) { - $crawler = self::$DI['client']->request('GET', '/account/', array( - 'notice' => $msg - )); + self::$DI['app']->addFlash($type, $message); + $crawler = self::$DI['client']->request('GET', '/account/'); $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); - $this->assertEquals(1, $crawler->filter('.notice')->count()); - } - - public function msgProvider() - { - return array( - array('pass-ok'), - array('pass-ko'), - array('account-update-ok'), - array('account-update-bad'), - array('demand-ok'), - ); + $this->assertFlashMessage($crawler, $type, 1, $message); } /** @@ -89,33 +77,37 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract /** * @covers \Alchemy\Phrasea\Controller\Root\Account::resetEmail */ - public function testPostResetMailWithToken() + public function testGetResetMailWithToken() { $token = self::$DI['app']['tokens']->getUrlToken(\random::TYPE_EMAIL, self::$DI['user']->get_id(), null, 'new_email@email.com'); - self::$DI['client']->request('POST', '/account/reset-email/', array('token' => $token)); + $crawler = self::$DI['client']->request('GET', '/account/reset-email/', array('token' => $token)); $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isRedirect()); - $this->assertEquals('/account/reset-email/?update=ok', $response->headers->get('location')); + $this->assertEquals('/account/', $response->headers->get('location')); $this->assertEquals('new_email@email.com', self::$DI['user']->get_email()); self::$DI['user']->set_email('noone@example.com'); try { self::$DI['app']['tokens']->helloToken($token); - $this->fail('TOken has not been removed'); + $this->fail('Token has not been removed'); } catch (\Exception_NotFound $e) { } + + $this->assertFlashMessagePopulated(self::$DI['app'], 'success', 1); } /** * @covers \Alchemy\Phrasea\Controller\Root\Account::resetEmail */ - public function testPostResetMailWithBadToken() + public function testGetResetMailWithBadToken() { - self::$DI['client']->request('POST', '/account/reset-email/', array('token' => '134dT0k3n')); + self::$DI['client']->request('GET', '/account/reset-email/', array('token' => '134dT0k3n')); $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isRedirect()); - $this->assertEquals('/account/reset-email/?update=ko', $response->headers->get('location')); + $this->assertEquals('/account/', $response->headers->get('location')); + + $this->assertFlashMessagePopulated(self::$DI['app'], 'error', 1); } /** @@ -141,7 +133,9 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isRedirect()); - $this->assertEquals('/account/reset-email/?notice=bad-password', $response->headers->get('location')); + $this->assertEquals('/account/reset-email/', $response->headers->get('location')); + + $this->assertFlashMessagePopulated(self::$DI['app'], 'error', 1); } /** @@ -159,7 +153,9 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isRedirect()); - $this->assertEquals('/account/reset-email/?notice=mail-invalid', $response->headers->get('location')); + $this->assertEquals('/account/reset-email/', $response->headers->get('location')); + + $this->assertFlashMessagePopulated(self::$DI['app'], 'error', 1); } /** @@ -177,7 +173,9 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isRedirect()); - $this->assertEquals('/account/reset-email/?notice=mail-match', $response->headers->get('location')); + $this->assertEquals('/account/reset-email/', $response->headers->get('location')); + + $this->assertFlashMessagePopulated(self::$DI['app'], 'error', 1); } /** @@ -197,53 +195,31 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isRedirect()); - $this->assertEquals('/account/reset-email/?update=mail-send', $response->headers->get('location')); + $this->assertEquals('/account/', $response->headers->get('location')); + + $this->assertFlashMessagePopulated(self::$DI['app'], 'info', 1); } /** * @dataProvider noticeProvider */ - public function testGetResetMailNotice($notice) + public function testGetResetMailNotice($type, $message) { - $crawler = self::$DI['client']->request('GET', '/account/reset-email/', array( - 'notice' => $notice - )); + self::$DI['app']->addFlash($type, $message); + + $crawler = self::$DI['client']->request('GET', '/account/reset-email/'); $this->assertTrue(self::$DI['client']->getResponse()->isOk()); - $this->assertEquals(2, $crawler->filter('.notice')->count()); + $this->assertFlashMessage($crawler, $type, 1, $message); } public function noticeProvider() { return array( - array('mail-server'), - array('mail-match'), - array('mail-invalid'), - array('bad-password'), - ); - } - - /** - * @dataProvider updateMsgProvider - */ - public function testGetResetMailUpdate($updateMessage) - { - $crawler = self::$DI['client']->request('GET', '/account/reset-email/', array( - 'update' => $updateMessage - )); - - $this->assertTrue(self::$DI['client']->getResponse()->isOk()); - - $this->assertEquals(1, $crawler->filter('.alert-info')->count()); - } - - public function updateMsgProvider() - { - return array( - array('ok'), - array('ko'), - array('mail-send'), + array('error', 'An error occured'), + array('info', 'You need to do something more'), + array('success', "Success operation !"), ); } @@ -284,28 +260,19 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract } /** - * @dataProvider passwordMsgProvider + * @dataProvider noticeProvider */ - public function testGetResetPasswordPassError($msg) + public function testGetResetPasswordPassError($type, $message) { - $crawler = self::$DI['client']->request('GET', '/account/reset-password/', array( - 'pass-error' => $msg - )); + self::$DI['app']->addFlash($type, $message); + + $crawler = self::$DI['client']->request('GET', '/account/reset-password/'); $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isOk()); - $this->assertEquals(1, $crawler->filter('.alert-error')->count()); - } - - public function passwordMsgProvider() - { - return array( - array('pass-match'), - array('pass-short'), - array('pass-invalid'), - ); + $this->assertFlashMessage($crawler, $type, 1, $message); } /** @@ -434,34 +401,35 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract /** * @dataProvider passwordProvider */ - public function testPostRenewPasswordBadArguments($oldPassword, $password, $passwordConfirm, $redirect) + public function testPostRenewPasswordBadArguments($oldPassword, $password, $passwordConfirm) { self::$DI['app']['authentication']->getUser()->set_password($oldPassword); - self::$DI['client']->request('POST', '/account/reset-password/', array( - 'form_password' => $password, - 'form_password_confirm' => $passwordConfirm, - 'form_old_password' => $oldPassword + $crawler = self::$DI['client']->request('POST', '/account/reset-password/', array( + 'password' => $password, + 'passwordConfirm' => $passwordConfirm, + 'oldPassword' => $oldPassword, + '_token' => 'token', )); $response = self::$DI['client']->getResponse(); - $this->assertTrue($response->isRedirect()); - $this->assertEquals($redirect, $response->headers->get('location')); + $this->assertFalse($response->isRedirect()); + $this->assertFlashMessage($crawler, 'error', 1); } public function testPostRenewPasswordBadOldPassword() { - self::$DI['client']->request('POST', '/account/reset-password/', array( - 'form_password' => 'password', - 'form_password_confirm' => 'password', - 'form_old_password' => 'oulala' + $crawler = self::$DI['client']->request('POST', '/account/reset-password/', array( + 'password' => 'password', + 'passwordConfirm' => 'password', + 'oldPassword' => 'oulala', + '_token' => 'token', )); $response = self::$DI['client']->getResponse(); - - $this->assertTrue($response->isRedirect()); - $this->assertEquals('/account/?notice=pass-ko', $response->headers->get('location')); + $this->assertFalse($response->isRedirect()); + $this->assertFlashMessage($crawler, 'error', 1); } public function testPostRenewPassword() @@ -471,23 +439,25 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract self::$DI['app']['authentication']->getUser()->set_password($password); self::$DI['client']->request('POST', '/account/reset-password/', array( - 'form_password' => 'password', - 'form_password_confirm' => 'password', - 'form_old_password' => $password + 'password' => 'password', + 'passwordConfirm' => 'password', + 'oldPassword' => $password, + '_token' => 'token', )); $response = self::$DI['client']->getResponse(); $this->assertTrue($response->isRedirect()); - $this->assertEquals('/account/?notice=pass-ok', $response->headers->get('location')); + $this->assertEquals('/account/', $response->headers->get('location')); + + $this->assertFlashMessagePopulated(self::$DI['app'], 'success', 1); } public function passwordProvider() { return array( - array(\random::generatePassword(), 'password', 'not_identical_password', '/account/reset-password/?pass-error=pass-match'), - array(\random::generatePassword(), 'min', 'min', '/account/reset-password/?pass-error=pass-short'), - array(\random::generatePassword(), 'invalid password \n', 'invalid password \n', '/account/reset-password/?pass-error=pass-invalid'), + array(\random::generatePassword(), 'password', 'not_identical_password'), + array(\random::generatePassword(), "invalid\n", "invalid\n"), ); } }