Browse Source

fix: allow only alphanumeric chars in username

pull/3437/head
varungujarathi9 2 years ago
parent
commit
1d37b21383
  1. 11
      web/pages/admin/config-federation.tsx

11
web/pages/admin/config-federation.tsx

@ -126,16 +126,13 @@ const ConfigFederation = () => { @@ -126,16 +126,13 @@ const ConfigFederation = () => {
const usernameValue = value;
const hasUsername = usernameValue !== '';
if (hasUsername) {
if (usernameValue.includes('@')) {
const usernameWithoutServer = usernameValue.split('@').slice(0, -1).join('@');
if (usernameWithoutServer.length > 0 && isAlphanumeric(usernameWithoutServer)) {
setIsUsernameValid(true);
} else {
setIsUsernameValid(false);
}
if (isAlphanumeric(usernameValue)) {
setIsUsernameValid(true);
} else {
setIsUsernameValid(false);
}
} else {
setIsUsernameValid(false);
}
};

Loading…
Cancel
Save