From cfe12956da6bb88a2c17dc7c8f29825405f771b9 Mon Sep 17 00:00:00 2001 From: Jxiced <48179642+Jxiced@users.noreply.github.com> Date: Thu, 20 Feb 2025 21:21:42 +0000 Subject: [PATCH] Remove trailing whitespace from new users' usernames (#6528) * Add input validation and error toast when attempting to add a new user with whitespaces at beginning or end. * Update from OR expression * Remove changes to en-gb due to only allowing direct commits to en-us. * Update to automatically trim instead of showing a message. --- src/apps/dashboard/routes/users/add.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/apps/dashboard/routes/users/add.tsx b/src/apps/dashboard/routes/users/add.tsx index 98cc928887..ffb8d3dc04 100644 --- a/src/apps/dashboard/routes/users/add.tsx +++ b/src/apps/dashboard/routes/users/add.tsx @@ -111,8 +111,9 @@ const UserNew = () => { const saveUser = () => { const userInput: UserInput = {}; - userInput.Name = (page.querySelector('#txtUsername') as HTMLInputElement).value; + userInput.Name = (page.querySelector('#txtUsername') as HTMLInputElement).value.trim(); userInput.Password = (page.querySelector('#txtPassword') as HTMLInputElement).value; + window.ApiClient.createUser(userInput).then(function (user) { if (!user.Id || !user.Policy) { throw new Error('Unexpected null user id or policy');