summaryrefslogtreecommitdiffstats
path: root/lib/private/User
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-09-01 17:07:13 +0200
committerGitHub <noreply@github.com>2022-09-01 17:07:13 +0200
commit253c0641b138d6eeb4397f82ba3738d9adb132a2 (patch)
tree43790db6d0806c3b34c7d332d14d4bc79d0c6d8f /lib/private/User
parent12e7f414f783acc9a30b7000a09b68a214077f04 (diff)
parentd59585974e2f3f51598da31f6e1dd0684affa77b (diff)
downloadnextcloud-server-253c0641b138d6eeb4397f82ba3738d9adb132a2.tar.gz
nextcloud-server-253c0641b138d6eeb4397f82ba3738d9adb132a2.zip
Merge pull request #33625 from nextcloud/fix/33572/add-user
Fix creation of new user and display the correct error message
Diffstat (limited to 'lib/private/User')
-rw-r--r--lib/private/User/Database.php4
-rw-r--r--lib/private/User/User.php3
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 78d4a51cf16..72c0d5c1a88 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);