Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edited the error message for existing username so that it suggests a … #157

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion public/src/client/register.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,20 @@ define('forum/register', [
if (results.every(obj => obj.status === 'rejected')) {
showSuccess(username_notify, successIcon);
} else {
showError(username_notify, '[[error:username-taken]]');
const newUsername = suggestUsername(username);
showError(username_notify, '[[error:username-taken. maybe-try-${newUsername}]]');
$('#username').val(newUsername);
}

callback();
});
}
}

function suggestUsername(username) {
return username + 123;
}

function validatePassword(password, password_confirm) {
const password_notify = $('#password-notify');
const password_confirm_notify = $('#password-confirm-notify');
Expand Down