-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(input): by default, do not trim input[type=password] values #8250
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
I don't really understand why we need this change. Are there password with leading / trailing whitespace? |
good question, but who cares! |
oops.. we never thought about trimming and passwords. this is definitely a fix that should be backported to 1.2. But does it make sense for passwords to ever be auto trimmed? in which case do we even need to support enabling the trimming? It looks like dead code to me. I suggest removing it and just documenting that trimming is not supported for input[type=password]. |
sounds good to me |
Do not trim input[type=password] values BREAKING CHANGE: Previously, input[type=password] would trim values by default, and would require an explicit ng-trim="false" to disable the trimming behaviour. After this CL, ng-trim no longer effects input[type=password], and will never trim the password value.
Changed to never trim if the input type is 'password' |
PTAL --- are we good to check this in for beta 18? |
Do not trim input[type=password] values BREAKING CHANGE: Previously, input[type=password] would trim values by default, and would require an explicit ng-trim="false" to disable the trimming behaviour. After this CL, ng-trim no longer effects input[type=password], and will never trim the password value. Closes #8250 Closes #8230 Conflicts: src/ng/directive/input.js
Unfortunately this is yet another change, that causes me additional work instead of simplifying things. I understand the rationale to not trim password fields by default. I think angular js itself should also be driven by actual user requirements. Another argument is the "principle of least surprise": If I add ng-trim="true" to a password field, it should not be silently ignored. |
Previously, all input types using ngModel and textInputType() would trim values if the ng-trim attribute was unspecified. This is undesirable for passwords because a user's input should always be canonical in that case.
This CL changes this behaviour by only trimming by-default if the input type is not password. In the future, if other input types need to be checked, or if the input type needs to be checked at runtime, this may be refactored to support those cases.
BREAKING CHANGE:
Previously, input[type=password] would trim values by default. This is no longer the case, and requires an explicit
ng-trim="value other than 'false'"
to ensure that the value is trimmed in casees where this is actually desirable.Example:
Closes #8230