Skip to content

Commit

Permalink
error admin_user.php nick or email already exits
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwhite authored and MyIgel committed Jan 13, 2024
1 parent 4d1502d commit b20124e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions includes/pages/admin_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,26 @@ function admin_user()
$user_source = User::find($user_id);

$changed_email = false;
$email = $request->postData('eemail');
if (($user_source->email !== $email) && User::whereEmail($email)->exists()) {
$html .= error(__('settings.profile.email.already-taken') . "\n", true);
break;
}
if ($user_source->settings->email_human) {
$changed_email = $user_source->email !== $request->postData('eemail');
$user_source->email = $request->postData('eemail');
$changed_email = $user_source->email !== $email;
$user_source->email = $email;
}

$changed_nick = false;
$nick = trim((string) $request->get('eNick'));
$nickValid = (new Username())->validate($nick);

$changed_nick = false;
if (($user_source->name !== $nick) && User::whereName($nick)->exists()) {
$html .= error(__('settings.profile.nick.already-taken') . "\n", true);
break;
}
$old_nick = $user_source->name;
if ($nickValid && $user_edit) {
$changed_nick = $user_source->name !== $nick;
$changed_nick = ($user_source->name !== $nick) || User::whereName($nick)->exists();
$user_source->name = $nick;
}
$user_source->save();
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en_US/additional.po
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ msgid "news.comment-delete.success"
msgstr "Comment successfully deleted."

msgid "news.edit.duplicate"
msgstr "Diese News wurde bereits erstellt."
msgstr "This news has already been created."

msgid "news.edit.success"
msgstr "News successfully updated."
Expand Down

0 comments on commit b20124e

Please sign in to comment.