mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Merge pull request #22072 from vincchan/trim-newusername-whitespace
Do not allow username to have whitespace at the beginning or at the end
This commit is contained in:
commit
2c41a266c0
1 changed files with 4 additions and 0 deletions
|
|
@ -265,6 +265,10 @@ class Manager extends PublicEmitter implements IUserManager {
|
|||
if (trim($uid) == '') {
|
||||
throw new \Exception($l->t('A valid username must be provided'));
|
||||
}
|
||||
// No whitespace at the beginning or at the end
|
||||
if (strlen(trim($uid, "\t\n\r\0\x0B\xe2\x80\x8b")) !== strlen(trim($uid))) {
|
||||
throw new \Exception($l->t('Username contains whitespace at the beginning or at the end'));
|
||||
}
|
||||
// No empty password
|
||||
if (trim($password) == '') {
|
||||
throw new \Exception($l->t('A valid password must be provided'));
|
||||
|
|
|
|||
Loading…
Reference in a new issue