summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-02-04 10:33:30 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-02-04 10:33:30 +0100
commit2c41a266c0ecf5dcfcbc2160761823ddd0f08525 (patch)
treec479db93dbbd3628823e42002d49036c9098ff8c /lib
parenta022584e4a8a0c0aa499c02df8ff5d7f7334deda (diff)
parentcc17ac9ff9e8b9efee94023bbacf50d1e7908873 (diff)
downloadnextcloud-server-2c41a266c0ecf5dcfcbc2160761823ddd0f08525.tar.gz
nextcloud-server-2c41a266c0ecf5dcfcbc2160761823ddd0f08525.zip
Merge pull request #22072 from vincchan/trim-newusername-whitespace
Do not allow username to have whitespace at the beginning or at the end
Diffstat (limited to 'lib')
-rw-r--r--lib/private/user/manager.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php
index 86750dcd994..6798a7340c3 100644
--- a/lib/private/user/manager.php
+++ b/lib/private/user/manager.php
@@ -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'));