From 822cb9ec5c97ba9b43ae13811cb0809ded53c356 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sun, 28 Nov 2021 05:09:14 +0000 Subject: [PATCH] Improve username generation --- webclient/src/LoginSignup.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/webclient/src/LoginSignup.js b/webclient/src/LoginSignup.js index 84d7b00..7710b1e 100644 --- a/webclient/src/LoginSignup.js +++ b/webclient/src/LoginSignup.js @@ -81,14 +81,13 @@ export function SignupForm(props) { const genUsername = () => { if (input.first_name && input.last_name) { - let first_name = input.first_name.trim(); - let last_name = input.last_name.trim(); + let first_name = input.first_name.trim().toLowerCase(); + let last_name = input.last_name.trim().toLowerCase(); first_name = first_name.replace(/[^a-z- ]+/g, ''); last_name = last_name.replace(/[^a-z- ]+/g, ''); first_name = first_name.replace(/[ -]/g, '.'); last_name = last_name.replace(/[ -]/g, '.'); - const username = first_name + '.' + last_name; - return username.toLowerCase(); + return first_name + '.' + last_name; } else { return ''; }