diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-08-19 20:02:57 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2022-08-22 19:13:11 +0000 |
commit | d59585974e2f3f51598da31f6e1dd0684affa77b (patch) | |
tree | 13cdd86687f7aba4f4c65b81d81b06b2ba982c7f /lib/private | |
parent | 2576609aac3555da0926c27b879df610a8b0f43c (diff) | |
download | nextcloud-server-d59585974e2f3f51598da31f6e1dd0684affa77b.tar.gz nextcloud-server-d59585974e2f3f51598da31f6e1dd0684affa77b.zip |
Fix creation of new user and display the correct error message
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/User/Database.php | 4 | ||||
-rw-r--r-- | lib/private/User/User.php | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 0b38f04bfe3..f106c2e8b6d 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -212,11 +212,13 @@ class Database extends ABackend implements * @param string $displayName The new display name * @return bool * + * @throws \InvalidArgumentException + * * Change the display name of a user */ public function setDisplayName(string $uid, string $displayName): bool { if (mb_strlen($displayName) > 64) { - return false; + throw new \InvalidArgumentException('Invalid displayname'); } $this->fixDI(); diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 7f7d6273e30..c24a5fe1c6b 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -154,6 +154,9 @@ class User implements IUser { * * @param string $displayName * @return bool + * + * @since 25.0.0 Throw InvalidArgumentException + * @throws \InvalidArgumentException */ public function setDisplayName($displayName) { $displayName = trim($displayName); |