Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#15439 closed enhancement (worksforme)

trim() Passwords and Logins

Reported by: sc0ttkclark Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.1
Component: Users Keywords:
Focuses: Cc:


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)

#1 @travisnorthcutt
11 years ago

  • Cc travisnorthcutt added

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

#2 @sc0ttkclark
11 years ago

I think, instead, we should be thinking of cases in which it is not a good idea to trim() these values.

#3 @hakre
11 years ago

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.

#4 @johnbillion
11 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.

#5 @sc0ttkclark
11 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?

#6 @hakre
11 years ago

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.

#7 @travisnorthcutt
11 years ago

  • Cc travisnorthcutt removed

#8 @nacin
11 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.