Do not allow whitespace characters in user names.#4888
Do not allow whitespace characters in user names.#4888driusan merged 2 commits intoaces:21.0-releasefrom
Conversation
| // Check that user name does not contain a whitespace character | ||
| if (preg_match('/\s/', $effectiveUID)) { | ||
| // Note: email adresses can contain comments which themselves can | ||
| // contain spaces |
There was a problem hiding this comment.
That's true for mail clients software, but is it true for LORIS?
The name part of "John Smith" <john.smith@example.com> is constructed, not user supplied. (Assuming that's what you're referring to..)
There was a problem hiding this comment.
You can enter an email address like me(yeah really me)@test.com on the create new user page in LORIS, and that is a valid email address with a user-supplied comment. My PR prevents the user name from being set to the email address in such a (rare/extreme) case.
There was a problem hiding this comment.
TIL. (That's an insane thing for the spec to allow.)
| // contain spaces | ||
| if ($values['NA_UserID'] == 'on') { | ||
| $errors['UserID_Group'] | ||
| = 'You cannot have the user name match an email adress' |
There was a problem hiding this comment.
| = 'You cannot have the user name match an email adress' | |
| = 'You cannot have the user name match an email address' |
Small typo.
Also I'm a little bit confused by this part of the code. What is this checking for?
There was a problem hiding this comment.
@johnsaigle I am trying to display an error message that is coherent with the way that the user name is set (i.e whether it was typed in the user name text field or if the 'Make user name match email address' checkbox was used).
|
@nicolasbrossard this is failing Travis |
|
@driusan It fails for PHP 7.2 but passes for PHP 7.3. Travis "bug"? |
|
you're right, looks transient.. I just restarted it |
Brief summary of changes
Spaces are not allowed anymore in user names. This PR implements this new restriction.
This resolves issue...
To test this change...
This replaces #4744, which is now closed.