Pre Merge pull request !506 from 御宅男(YznCMS官方)/Branch_f804c8a5

pull/506/MERGE
御宅男(YznCMS官方) 2025-08-06 02:55:51 +00:00 committed by Gitee
commit ae1e904dbf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 2 deletions

View File

@ -179,14 +179,14 @@ class User extends Api
$bio = $this->request->post('bio');
$avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars');
if ($username) {
$exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find();
$exists = \app\common\model\User::where('username', $username)->where('id', '<>', $user->id)->find();
if ($exists) {
$this->error(__('Username already exists'));
}
$user->username = $username;
}
if ($nickname) {
$exists = \app\common\model\User::where('nickname', $nickname)->where('id', '<>', $this->auth->id)->find();
$exists = \app\common\model\User::where('nickname', $nickname)->where('id', '<>', $user->id)->find();
if ($exists) {
$this->error(__('Nickname already exists'));
}