diff --git a/lib/Alchemy/Phrasea/Command/Setup/LessCompiler.php b/lib/Alchemy/Phrasea/Command/Setup/LessCompiler.php index 03fa97e825..ae50540f7f 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/LessCompiler.php +++ b/lib/Alchemy/Phrasea/Command/Setup/LessCompiler.php @@ -12,6 +12,7 @@ namespace Alchemy\Phrasea\Command\Setup; use Alchemy\Phrasea\Command\Command; +use Alchemy\Phrasea\Exception\RuntimeException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\ProcessBuilder; @@ -49,14 +50,13 @@ class LessCompiler extends Command $output->writeln(sprintf('Building %s', basename($lessFile))); if (!is_file($lessFile)) { - throw new \Exception(realpath($lessFile) . ' does not exists'); + throw new RuntimeException(realpath($lessFile) . ' does not exists.'); } if (!is_writable(dirname($buildFile))) { - throw new \Exception(realpath(dirname($buildFile)) . ' is not writable'); + throw new RuntimeException(realpath(dirname($buildFile)) . ' is not writable.'); } - $builder = ProcessBuilder::create(array( 'recess', '--compile', diff --git a/lib/Alchemy/Phrasea/Controller/Root/Account.php b/lib/Alchemy/Phrasea/Controller/Root/Account.php index eb8ea1e337..39c47926f9 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Account.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Account.php @@ -91,15 +91,10 @@ class Account implements ControllerProviderInterface if ($form->isValid()) { $data = $form->getData(); - - $password = $data['password']; - $user = $app['authentication']->getUser(); - 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($password); + if ($app['auth.password-encoder']->isPasswordValid($user->get_password(), $data['oldPassword'], $user->get_nonce())) { + $user->set_password($data['password']); $app->addFlash('success', _('login::notification: Mise a jour du mot de passe avec succes')); return $app->redirectPath('account'); diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index c742c7ef8e..b811fa5649 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -175,7 +175,6 @@ class Login implements ControllerProviderInterface $controllers->get('/language.json', 'login.controller:getLanguage') ->bind('login_language'); - return $controllers; } @@ -183,11 +182,11 @@ class Login implements ControllerProviderInterface { $response = $app->json(array( 'validation_blank' => _('Please provide a value.'), - 'validation_choice_min' => _('please select at least %s choice.'), + 'validation_choice_min' => _('Please select at least %s choice.'), 'validation_email' => _('Please provide a valid email address.'), 'validation_ip' => _('Please provide a valid IP address.'), - 'validation_length_min' => _('Please provide a longer value. It should have %s character or more'), - 'password_match' => _('Please provide the same passwords'), + 'validation_length_min' => _('Please provide a longer value. It should have %s character or more.'), + 'password_match' => _('Please provide the same passwords.'), 'accept_tou' => _('You must accept the terms of use.'), 'none_selected' => _('None selected'), 'collections' => _('Collections'), diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php index b4046a56c4..48b1e2c596 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php @@ -32,24 +32,24 @@ class PhraseaRecoverPasswordForm extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('token', 'hidden', array( - 'required' => true, - 'constraints' => array( + 'required' => true, + 'constraints' => array( new PasswordToken($this->app, $this->app['tokens']) ) )); $builder->add('password', 'repeated', array( - 'type' => 'password', - 'required' => true, - 'constraints' => array( + 'type' => 'password', + 'required' => true, + 'invalid_message' => _('Please provide the same passwords.'), + 'first_name' => 'password', + 'second_name' => 'confirm', + 'first_options' => array('label' => _('New password')), + 'second_options' => array('label' => _('New password (confirmation)')), + 'constraints' => array( new Assert\NotBlank(), new Assert\Length(array('min' => 5)), ), - 'invalid_message' => _('Please provide the same passwords'), - 'first_name' => 'password', - 'second_name' => 'confirm', - 'first_options' => array('label' => _('New password')), - 'second_options' => array('label' => _('New password (confirmation)')), )); } diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php index ec3db7b32c..d631735a94 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php @@ -46,25 +46,25 @@ class PhraseaRegisterForm extends AbstractType $builder->add('password', 'repeated', array( - 'type' => 'password', - 'required' => true, - 'constraints' => array( + 'type' => 'password', + 'required' => true, + 'invalid_message' => _('Please provide the same passwords.'), + 'first_name' => 'password', + 'second_name' => 'confirm', + 'first_options' => array('label' => _('Password')), + 'second_options' => array('label' => _('Password (confirmation)')), + 'constraints' => array( new Assert\NotBlank(), new Assert\Length(array('min' => 5)), ), - 'invalid_message' => _('Please provide the same passwords'), - 'first_name' => 'password', - 'second_name' => 'confirm', - 'first_options' => array('label' => _('Password')), - 'second_options' => array('label' => _('Password (confirmation)')), )); $builder->add('accept-tou', 'checkbox', array( - 'label' => _('Terms of Use'), - 'mapped' => false, - "constraints" => array( + 'label' => _('Terms of Use'), + 'mapped' => false, + "constraints" => array( new Assert\True(array( - "message" => _("Please accept the Terms and conditions in order to register") + "message" => _("Please accept the Terms and conditions in order to register.") ))), )); diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRenewPasswordForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRenewPasswordForm.php index 01814641e3..04236af7cb 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRenewPasswordForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRenewPasswordForm.php @@ -23,25 +23,25 @@ class PhraseaRenewPasswordForm extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('oldPassword', 'password', array( - 'label' => _('Current password'), - 'required' => true, - 'constraints' => array( + 'label' => _('Current password'), + 'required' => true, + 'constraints' => array( new Assert\NotBlank() ) )); $builder->add('password', 'repeated', array( - 'type' => 'password', - 'required' => true, - 'constraints' => array( + 'type' => 'password', + 'required' => true, + 'invalid_message' => _('Please provide the same passwords.'), + 'first_name' => 'password', + 'second_name' => 'confirm', + 'first_options' => array('label' => _('New password')), + 'second_options' => array('label' => _('New password (confirmation)')), + 'constraints' => array( new Assert\NotBlank(), new Assert\Length(array('min' => 5)), ), - 'invalid_message' => _('Please provide the same passwords'), - 'first_name' => 'password', - 'second_name' => 'confirm', - 'first_options' => array('label' => _('New password')), - 'second_options' => array('label' => _('New password (confirmation)')), )); } diff --git a/templates/web/account/change-password.html.twig b/templates/web/account/change-password.html.twig index 3fe7963ec9..a179b439c4 100644 --- a/templates/web/account/change-password.html.twig +++ b/templates/web/account/change-password.html.twig @@ -54,5 +54,5 @@ {% block scripts %} {{ parent() }} - + {% endblock %} diff --git a/templates/web/login/forgot-password.html.twig b/templates/web/login/forgot-password.html.twig index 977b6c2905..2bd5541cef 100644 --- a/templates/web/login/forgot-password.html.twig +++ b/templates/web/login/forgot-password.html.twig @@ -55,5 +55,5 @@ {% block scripts %} {{ parent() }} - + {% endblock %} diff --git a/templates/web/login/index.html.twig b/templates/web/login/index.html.twig index 6ec17964dd..cb3fb3a199 100644 --- a/templates/web/login/index.html.twig +++ b/templates/web/login/index.html.twig @@ -130,5 +130,5 @@ {% block scripts %} {{ parent() }} - + {% endblock %} diff --git a/templates/web/login/oauth/login.html.twig b/templates/web/login/oauth/login.html.twig index 47546fa69b..f1f90ff162 100644 --- a/templates/web/login/oauth/login.html.twig +++ b/templates/web/login/oauth/login.html.twig @@ -124,5 +124,5 @@ {% block scripts %} {{ parent() }} - + {% endblock %} diff --git a/templates/web/login/providers/bind.html.twig b/templates/web/login/providers/bind.html.twig index 59110b92d9..2ddd01d839 100644 --- a/templates/web/login/providers/bind.html.twig +++ b/templates/web/login/providers/bind.html.twig @@ -88,5 +88,5 @@ {% block scripts %} {{ parent() }} - + {% endblock %} diff --git a/templates/web/login/providers/mapping.html.twig b/templates/web/login/providers/mapping.html.twig index 9803dab83a..0895de9215 100644 --- a/templates/web/login/providers/mapping.html.twig +++ b/templates/web/login/providers/mapping.html.twig @@ -120,5 +120,5 @@ {% block scripts %} {{ parent() }} - + {% endblock %} diff --git a/templates/web/login/register-classic.html.twig b/templates/web/login/register-classic.html.twig index 1d59400a07..f139a4d8a9 100644 --- a/templates/web/login/register-classic.html.twig +++ b/templates/web/login/register-classic.html.twig @@ -101,5 +101,5 @@ {% block scripts %} {{ parent() }} - + {% endblock %} diff --git a/templates/web/login/register-provider.html.twig b/templates/web/login/register-provider.html.twig index 45b6e06d06..d8a186c280 100644 --- a/templates/web/login/register-provider.html.twig +++ b/templates/web/login/register-provider.html.twig @@ -86,3 +86,8 @@ {% endblock %} + +{% block scripts %} + {{ parent() }} + +{% endblock %} diff --git a/templates/web/login/renew-password.html.twig b/templates/web/login/renew-password.html.twig index c2e0a9cb0a..2d8b3a5804 100644 --- a/templates/web/login/renew-password.html.twig +++ b/templates/web/login/renew-password.html.twig @@ -50,5 +50,5 @@ {% block scripts %} {{ parent() }} - + {% endblock %} diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php index e020dd2af2..63a9326208 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php @@ -475,7 +475,6 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { return array( array(\random::generatePassword(), 'password', 'not_identical_password'), - array(\random::generatePassword(), "invalid\n", "invalid\n"), ); } } diff --git a/www/scripts/apps/login/home/config.js b/www/scripts/apps/login/home/config.js index 943ded727f..8672f2a816 100644 --- a/www/scripts/apps/login/home/config.js +++ b/www/scripts/apps/login/home/config.js @@ -11,7 +11,7 @@ require.config({ baseUrl: "/scripts", paths: { - jquery: "../include/jslibs/jquery-1.7.1", + jquery: "../assets/jquery/jquery", jqueryui: "../include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min", underscore: "../assets/underscore-amd/underscore", backbone: "../assets/backbone-amd/backbone",