diff --git a/public/src/client/register.js b/public/src/client/register.js index 62dbc41..8b818c0 100644 --- a/public/src/client/register.js +++ b/public/src/client/register.js @@ -131,7 +131,20 @@ define('forum/register', [ if (results.every(obj => obj.status === 'rejected')) { showSuccess(username_notify, successIcon); } else { - showError(username_notify, '[[error:username-taken]]'); + // --- NEW: suggest an alternative username --- + const suggestion = username + 'suffix'; + translator.translate('[[error:username-taken]]', function (msg) { + username_notify.html( + msg + ' ' + + 'Try this instead: ' + + `${suggestion}` + ); + username_notify.parent() + .removeClass('register-success') + .addClass('register-danger'); + username_notify.show(); + }); + validationError = true; } callback(); @@ -139,6 +152,7 @@ define('forum/register', [ } } + function validatePassword(password, password_confirm) { const password_notify = $('#password-notify'); const password_confirm_notify = $('#password-confirm-notify');