Improve username generation
This commit is contained in:
parent
70764ee53e
commit
822cb9ec5c
|
@ -81,14 +81,13 @@ export function SignupForm(props) {
|
||||||
|
|
||||||
const genUsername = () => {
|
const genUsername = () => {
|
||||||
if (input.first_name && input.last_name) {
|
if (input.first_name && input.last_name) {
|
||||||
let first_name = input.first_name.trim();
|
let first_name = input.first_name.trim().toLowerCase();
|
||||||
let last_name = input.last_name.trim();
|
let last_name = input.last_name.trim().toLowerCase();
|
||||||
first_name = first_name.replace(/[^a-z- ]+/g, '');
|
first_name = first_name.replace(/[^a-z- ]+/g, '');
|
||||||
last_name = last_name.replace(/[^a-z- ]+/g, '');
|
last_name = last_name.replace(/[^a-z- ]+/g, '');
|
||||||
first_name = first_name.replace(/[ -]/g, '.');
|
first_name = first_name.replace(/[ -]/g, '.');
|
||||||
last_name = last_name.replace(/[ -]/g, '.');
|
last_name = last_name.replace(/[ -]/g, '.');
|
||||||
const username = first_name + '.' + last_name;
|
return first_name + '.' + last_name;
|
||||||
return username.toLowerCase();
|
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user