8000 merged branch egeloen/password-type (PR #6007) · lanthaler/symfony@68ae207 · GitHub
[go: up one dir, main page]

Skip to content

Commit 68ae207

Browse files
committed
merged branch egeloen/password-type (PR symfony#6007)
This PR was merged into the master branch. Commits ------- 97f6a1b [Form] Update password type trimming to false Discussion ---------- [Form] Update password trimming to false by default Bug fix: yes Feature addition: no Backwards compatibility break: yes Symfony2 tests pass: yes Fixes the following tickets: ~ Todo: - License of the code: MIT Documentation PR: ~ Hey! Today, I realize that the password type is by default trimmed. IMHO, this is not the expected behavior. By default, the password type should not trim the input value. Regards --------------------------------------------------------------------------- by nomack84 at 2012-11-13T19:16:29Z :+1: --------------------------------------------------------------------------- by mvrhov at 2012-11-13T19:57:29Z IMHO password and username fields should be trimmed. whitespace at the beginning and at the end of those fields are not wanted. At least I don't want to deal with a user support where WS on those fields is not trimmed. --------------------------------------------------------------------------- by egeloen at 2012-11-13T20:08:08Z @mvrhov I agree with you about username fields and other "text" fields but in case of a password field, if the end user specifies white space at the begin/end of his password, it should not be trimmed. It should simply let it as it is. I open this PR due to two customers who reports me this behavior. --------------------------------------------------------------------------- by clemherreman at 2012-11-14T10:06:15Z @mvrhov I agree, username shouldn't be trimmed, however password are kind of special. They should be used *"as is"*, as lots of users have wicked passwords. Moreover, usually the password is asked twice, so if there are spaces, they are most likely wanted by the end user. So 👍 --------------------------------------------------------------------------- by clemherreman at 2012-11-14T10:07:27Z Also Travis status on this PR is **failed** because of an error when downloading the deps. --------------------------------------------------------------------------- by geoffrey-brier at 2012-11-14T10:34:56Z 👍 --------------------------------------------------------------------------- by bschussek at 2012-11-14T15:01:43Z Could you please add a test case to PasswordTypeTest? Please also reference this PR in the test (= add the comment `// https://github.com/symfony/symfony/pull/6007` before the test) --------------------------------------------------------------------------- by egeloen at 2012-11-14T15:10:36Z @bschussek I have updated the PR. --------------------------------------------------------------------------- by bschussek at 2012-11-14T15:24:34Z Thanks! Could you please squash the commits? --------------------------------------------------------------------------- by egeloen at 2012-11-14T15:30:11Z @bschussek Done. --------------------------------------------------------------------------- by stloyd at 2012-11-14T15:39:47Z Should this be noted in `UPGRADE` file ? (as this is change of actually BC break =)) --------------------------------------------------------------------------- by egeloen at 2012-11-15T22:59:45Z @stloyd Where can I put it? In the [UPGRADE-2.2](https://github.com/symfony/symfony/blob/master/UPGRADE-2.2.md) file? --------------------------------------------------------------------------- by stloyd at 2012-11-15T23:02:51Z @egeloen IMO yes, according this will go to `master` (which is actual _dev_ branch for `2.2`) --------------------------------------------------------------------------- by egeloen at 2012-11-16T13:54:04Z @fabpot I have removed the comment & added an entry in the `UPGRADE-2.2` file.
2 parents e3f8d2d + 97f6a1b commit 68ae207

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

UPGRADE-2.2.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@
3131
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))->all();
3232
3333
```
34+
35+
### Form
36+
37+
* The PasswordType is now not trimmed by default.

src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
3535
{
3636
$resolver->setDefaults(array(
3737
'always_empty' => true,
38+
'trim' => false,
3839
));
3940
}
4041

src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,13 @@ public function testNotEmptyIfBoundAndNotAlwaysEmpty()
3939

4040
$this->assertSame('pAs5w0rd', $view->vars['value']);
4141
}
42+
43+
public function testNotTrimmed()
44+
{
45+
$form = $this->factory->create('password', null);
46+
$form->bind(' pAs5w0rd 4F00 ');
47+
$data = $form->getData();
48+
49+
$this->assertSame(' pAs5w0rd ', $data);
50+
}
4251
}

0 commit comments

Comments
 (0)
0