Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#15439 closed enhancement (worksforme)

trim() Passwords and Logins

Reported by: sc0ttkclark 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)

  • Cc travisnorthcutt added

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

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.

  • 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.

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.

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