Adressed PR comment's

Fix tests

Add dot at end of senetences

Fix typo
This commit is contained in:
Nicolas Le Goff
2013-06-12 19:21:01 +02:00
parent 853477177b
commit f30bca91a9
17 changed files with 55 additions and 57 deletions

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Command\Setup; namespace Alchemy\Phrasea\Command\Setup;
use Alchemy\Phrasea\Command\Command; use Alchemy\Phrasea\Command\Command;
use Alchemy\Phrasea\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Process\ProcessBuilder;
@@ -49,14 +50,13 @@ class LessCompiler extends Command
$output->writeln(sprintf('Building %s', basename($lessFile))); $output->writeln(sprintf('Building %s', basename($lessFile)));
if (!is_file($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))) { 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( $builder = ProcessBuilder::create(array(
'recess', 'recess',
'--compile', '--compile',

View File

@@ -91,15 +91,10 @@ class Account implements ControllerProviderInterface
if ($form->isValid()) { if ($form->isValid()) {
$data = $form->getData(); $data = $form->getData();
$password = $data['password'];
$user = $app['authentication']->getUser(); $user = $app['authentication']->getUser();
if (trim($password) != str_replace(array("\r\n", "\n", "\r", "\t", " "), "_", $password)) { if ($app['auth.password-encoder']->isPasswordValid($user->get_password(), $data['oldPassword'], $user->get_nonce())) {
$app->addFlash('error', _('forms::la valeur donnee contient des caracteres invalides')); $user->set_password($data['password']);
} elseif ($app['auth.password-encoder']->isPasswordValid($user->get_password(), $data['oldPassword'], $user->get_nonce())) {
$user->set_password($password);
$app->addFlash('success', _('login::notification: Mise a jour du mot de passe avec succes')); $app->addFlash('success', _('login::notification: Mise a jour du mot de passe avec succes'));
return $app->redirectPath('account'); return $app->redirectPath('account');

View File

@@ -175,7 +175,6 @@ class Login implements ControllerProviderInterface
$controllers->get('/language.json', 'login.controller:getLanguage') $controllers->get('/language.json', 'login.controller:getLanguage')
->bind('login_language'); ->bind('login_language');
return $controllers; return $controllers;
} }
@@ -183,11 +182,11 @@ class Login implements ControllerProviderInterface
{ {
$response = $app->json(array( $response = $app->json(array(
'validation_blank' => _('Please provide a value.'), '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_email' => _('Please provide a valid email address.'),
'validation_ip' => _('Please provide a valid IP address.'), 'validation_ip' => _('Please provide a valid IP address.'),
'validation_length_min' => _('Please provide a longer value. It should have %s character or more'), 'validation_length_min' => _('Please provide a longer value. It should have %s character or more.'),
'password_match' => _('Please provide the same passwords'), 'password_match' => _('Please provide the same passwords.'),
'accept_tou' => _('You must accept the terms of use.'), 'accept_tou' => _('You must accept the terms of use.'),
'none_selected' => _('None selected'), 'none_selected' => _('None selected'),
'collections' => _('Collections'), 'collections' => _('Collections'),

View File

@@ -32,24 +32,24 @@ class PhraseaRecoverPasswordForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('token', 'hidden', array( $builder->add('token', 'hidden', array(
'required' => true, 'required' => true,
'constraints' => array( 'constraints' => array(
new PasswordToken($this->app, $this->app['tokens']) new PasswordToken($this->app, $this->app['tokens'])
) )
)); ));
$builder->add('password', 'repeated', array( $builder->add('password', 'repeated', array(
'type' => 'password', 'type' => 'password',
'required' => true, 'required' => true,
'constraints' => array( '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\NotBlank(),
new Assert\Length(array('min' => 5)), 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)')),
)); ));
} }

View File

@@ -46,25 +46,25 @@ class PhraseaRegisterForm extends AbstractType
$builder->add('password', 'repeated', array( $builder->add('password', 'repeated', array(
'type' => 'password', 'type' => 'password',
'required' => true, 'required' => true,
'constraints' => array( '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\NotBlank(),
new Assert\Length(array('min' => 5)), 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( $builder->add('accept-tou', 'checkbox', array(
'label' => _('Terms of Use'), 'label' => _('Terms of Use'),
'mapped' => false, 'mapped' => false,
"constraints" => array( "constraints" => array(
new Assert\True(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.")
))), ))),
)); ));

View File

@@ -23,25 +23,25 @@ class PhraseaRenewPasswordForm extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder->add('oldPassword', 'password', array( $builder->add('oldPassword', 'password', array(
'label' => _('Current password'), 'label' => _('Current password'),
'required' => true, 'required' => true,
'constraints' => array( 'constraints' => array(
new Assert\NotBlank() new Assert\NotBlank()
) )
)); ));
$builder->add('password', 'repeated', array( $builder->add('password', 'repeated', array(
'type' => 'password', 'type' => 'password',
'required' => true, 'required' => true,
'constraints' => array( '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\NotBlank(),
new Assert\Length(array('min' => 5)), 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)')),
)); ));
} }

View File

@@ -54,5 +54,5 @@
{% block scripts %} {% block scripts %}
{{ parent() }} {{ parent() }}
<script type="text/javascript" src="/scripts/apps/login/home/renewPassword.js"></script> <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/renewPassword.js'}) }}"></script>
{% endblock %} {% endblock %}

View File

@@ -55,5 +55,5 @@
{% block scripts %} {% block scripts %}
{{ parent() }} {{ parent() }}
<script type="text/javascript" src="/scripts/apps/login/home/forgotPassword.js"></script> <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/forgotPassword.js'}) }}"></script>
{% endblock %} {% endblock %}

View File

@@ -130,5 +130,5 @@
{% block scripts %} {% block scripts %}
{{ parent() }} {{ parent() }}
<script type="text/javascript" src="/scripts/apps/login/home/login.js"></script> <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/login.js'}) }}"></script>
{% endblock %} {% endblock %}

View File

@@ -124,5 +124,5 @@
{% block scripts %} {% block scripts %}
{{ parent() }} {{ parent() }}
<script type="text/javascript" src="/scripts/apps/login/home/oauthLogin.js"></script> <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/oauthLogin.js'}) }}"></script>
{% endblock %} {% endblock %}

View File

@@ -88,5 +88,5 @@
{% block scripts %} {% block scripts %}
{{ parent() }} {{ parent() }}
<script type="text/javascript" src="/scripts/apps/login/home/bind.js"></script> <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/bind.js'}) }}"></script>
{% endblock %} {% endblock %}

View File

@@ -120,5 +120,5 @@
{% block scripts %} {% block scripts %}
{{ parent() }} {{ parent() }}
<script type="text/javascript" src="/scripts/apps/login/home/mapping.js"></script> <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/mapping.js'}) }}"></script>
{% endblock %} {% endblock %}

View File

@@ -101,5 +101,5 @@
{% block scripts %} {% block scripts %}
{{ parent() }} {{ parent() }}
<script type="text/javascript" src="/scripts/apps/login/home/register.js"></script> <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/register.js'}) }}"></script>
{% endblock %} {% endblock %}

View File

@@ -86,3 +86,8 @@
</div> </div>
</div> </div>
{% endblock %} {% endblock %}
{% block scripts %}
{{ parent() }}
<script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/registerProvider.js'}) }}"></script>
{% endblock %}

View File

@@ -50,5 +50,5 @@
{% block scripts %} {% block scripts %}
{{ parent() }} {{ parent() }}
<script type="text/javascript" src="/scripts/apps/login/home/recoverPassword.js"></script> <script type="text/javascript" src="{{ path('minifier', {'f': 'scripts/apps/login/home/recoverPassword.js'}) }}"></script>
{% endblock %} {% endblock %}

View File

@@ -475,7 +475,6 @@ class AccountTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{ {
return array( return array(
array(\random::generatePassword(), 'password', 'not_identical_password'), array(\random::generatePassword(), 'password', 'not_identical_password'),
array(\random::generatePassword(), "invalid\n", "invalid\n"),
); );
} }
} }

View File

@@ -11,7 +11,7 @@
require.config({ require.config({
baseUrl: "/scripts", baseUrl: "/scripts",
paths: { 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", jqueryui: "../include/jslibs/jquery-ui-1.8.17/js/jquery-ui-1.8.17.custom.min",
underscore: "../assets/underscore-amd/underscore", underscore: "../assets/underscore-amd/underscore",
backbone: "../assets/backbone-amd/backbone", backbone: "../assets/backbone-amd/backbone",