mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 17:23:59 -04:00
Merge pull request #33052 from nextcloud/fix/set-display-name
Do not send display name twice for saving
This commit is contained in:
commit
744f1dd563
4 changed files with 11 additions and 3 deletions
|
|
@ -837,7 +837,9 @@ class UsersController extends AUserData {
|
|||
switch ($key) {
|
||||
case self::USER_FIELD_DISPLAYNAME:
|
||||
case IAccountManager::PROPERTY_DISPLAYNAME:
|
||||
$targetUser->setDisplayName($value);
|
||||
if (!$targetUser->setDisplayName($value)) {
|
||||
throw new OCSException('Invalid displayname', 102);
|
||||
}
|
||||
break;
|
||||
case self::USER_FIELD_QUOTA:
|
||||
$quota = $value;
|
||||
|
|
|
|||
|
|
@ -1486,7 +1486,8 @@ class UsersControllerTest extends TestCase {
|
|||
$targetUser
|
||||
->expects($this->once())
|
||||
->method('setDisplayName')
|
||||
->with('NewDisplayName');
|
||||
->with('NewDisplayName')
|
||||
->willReturn(true);
|
||||
$targetUser
|
||||
->expects($this->any())
|
||||
->method('getUID')
|
||||
|
|
|
|||
|
|
@ -128,7 +128,8 @@
|
|||
_.each(this._inputFields, function(field) {
|
||||
if (
|
||||
field === 'avatar' ||
|
||||
field === 'email'
|
||||
field === 'email' ||
|
||||
field === 'displayname'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,6 +215,10 @@ class Database extends ABackend implements
|
|||
* Change the display name of a user
|
||||
*/
|
||||
public function setDisplayName(string $uid, string $displayName): bool {
|
||||
if (mb_strlen($displayName) > 64) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->fixDI();
|
||||
|
||||
if ($this->userExists($uid)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue