diff --git a/public/src/client/register.js b/public/src/client/register.js index 62dbc41..fe13476 100644 --- a/public/src/client/register.js +++ b/public/src/client/register.js @@ -131,7 +131,9 @@ 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(); @@ -139,6 +141,10 @@ define('forum/register', [ } } + function suggestUsername(username) { + return username + 123; + } + function validatePassword(password, password_confirm) { const password_notify = $('#password-notify'); const password_confirm_notify = $('#password-confirm-notify');