From 11c1d99533f481a8451df34ce1e883d9213883f9 Mon Sep 17 00:00:00 2001 From: Evelyn Lo Date: Mon, 3 Feb 2025 13:42:44 -0500 Subject: [PATCH] suggest username when taken --- public/src/client/register.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/src/client/register.js b/public/src/client/register.js index 62dbc41..6ea66cf 100644 --- a/public/src/client/register.js +++ b/public/src/client/register.js @@ -123,6 +123,7 @@ define('forum/register', [ showError(username_notify, '[[error:username-too-long]]'); } else if (!utils.isUserNameValid(username) || !userslug) { showError(username_notify, '[[error:invalid-username]]'); + } else { Promise.allSettled([ api.head(`/users/bySlug/${username}`, {}), @@ -131,7 +132,8 @@ define('forum/register', [ if (results.every(obj => obj.status === 'rejected')) { showSuccess(username_notify, successIcon); } else { - showError(username_notify, '[[error:username-taken]]'); + const suggestedUsername = username + "suffix"; + showError(username_notify, `[[error:username-taken]] Try: ${suggestedUsername}`); } callback(); @@ -139,6 +141,7 @@ define('forum/register', [ } } + function validatePassword(password, password_confirm) { const password_notify = $('#password-notify'); const password_confirm_notify = $('#password-confirm-notify');