Skip to content

Commit

Permalink
Trimming out the extra spaces while creating new user
Browse files Browse the repository at this point in the history
  • Loading branch information
vipinpaul committed Apr 8, 2024
1 parent 413f58a commit 7c52dc1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions renderer/src/components/Login/LeftLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ const LeftLogin = () => {
};
function formSubmit(event) {
event.preventDefault();
if (values.username.length < 3 || values.username.length > 15) {
const newValue = values;
newValue.username = newValue.username.trim();
if (newValue.username.length < 3 || newValue.username.length > 15) {
displayError('The input has to be between 3 and 15 characters long');
} else if (users.length > 0 && users.find((item) => (item.username.toLowerCase() === values.username.toLowerCase().trim()))) {
} else if (users.length > 0 && users.find((item) => (item.username.toLowerCase() === newValue.username.toLowerCase()))) {
displayError('User exists, Check archived and active tab by click on view more.');
} else {
handleSubmit(values);
handleSubmit(newValue);
setValues({});
}
}
Expand Down

0 comments on commit 7c52dc1

Please sign in to comment.