#15439 closed enhancement (worksforme)
trim() Passwords and Logins
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Users | Version: | 3.1 |
| Severity: | minor | Keywords: | |
| Cc: |
Description
I'm putting this ticket up to discuss the addition of the trim() function in the wp_signon and related functions so that in the event you are copying/pasting from an e-mail program or browser and there is whitespace - your login won't fail.
So, the trim() would need to be in a number of places, but specifically when signing in, when adding a user, and when changing a password.
Thoughts? Stones?
Change History (8)
comment:1
travisnorthcutt — 3 years ago
- Cc travisnorthcutt added
comment:2
sc0ttkclark — 3 years ago
I think, instead, we should be thinking of cases in which it is not a good idea to trim() these values.
From what I know, it get's already trimmed. Please check, but I copied over usernames and passwords containing whitespaces around so often in support and never run into any problems.
I'm pretty sure what you ask for is already the standard behavior. Please verify.
comment:4
johnbillion — 3 years ago
- Resolution set to worksforme
- Status changed from new to closed
As Hakre points out, this is the current behaviour.
See wp_authenticate() in wp-includes/pluggable.php'. The password is trimmed there, and sanitize_user()` takes care of trimming the username.
comment:5
sc0ttkclark — 3 years ago
I'm wondering why this isn't done in wp_signon specifically to the value before it's passed through for consistency instead of requiring functions hooking into it to trim it each time?
Well as you're talking about code, trim the value before you pass it to the function. If you're really interested to add this into core, please provide a patch.
comment:7
travisnorthcutt — 2 years ago
- Cc travisnorthcutt removed

Seems logical, but is this a common enough complaint/problem to warrant 'fixing' it?