mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-09-21 15:56:24 +08:00
fixed a bug where users would be asked to change name right after registering
This commit is contained in:
parent
d6f7097516
commit
ea542ac2ac
|
@ -102,7 +102,7 @@ function signUp() {
|
|||
// Account has been created here.
|
||||
let usr = user.user;
|
||||
usr.updateProfile({
|
||||
displayName: name
|
||||
displayName: nname
|
||||
}).then(function() {
|
||||
// Update successful.
|
||||
showNotification("Account created", 2000);
|
||||
|
|
|
@ -125,23 +125,23 @@ function verifyUsername(){
|
|||
Sorry for this inconvenience.
|
||||
`);
|
||||
let newName = prompt('Please provide a new username - you can use lowercase and uppercase characters, numbers and one of these special characters ( . _ - ). The new name cannot be longer than 12 characters.',firebase.auth().currentUser.displayName);
|
||||
|
||||
cn = firebase.functions().httpsCallable('changeName');
|
||||
cn({uid:firebase.auth().currentUser.uid,name:newName}).then(d => {
|
||||
if(d.data === 1){
|
||||
//all good
|
||||
alert('Thanks! All good.');
|
||||
location.reload();
|
||||
$('.nameChangeMessage').slideUp();
|
||||
}else if(d.data === 0){
|
||||
//invalid or unavailable
|
||||
alert('Name invalid or taken. Try again.');
|
||||
}else if(d.data === -1){
|
||||
//error
|
||||
alert('Unknown error. Contact Miodec on Discord.');
|
||||
}
|
||||
});
|
||||
|
||||
if(newName){
|
||||
cn = firebase.functions().httpsCallable('changeName');
|
||||
cn({uid:firebase.auth().currentUser.uid,name:newName}).then(d => {
|
||||
if(d.data === 1){
|
||||
//all good
|
||||
alert('Thanks! All good.');
|
||||
location.reload();
|
||||
$('.nameChangeMessage').slideUp();
|
||||
}else if(d.data === 0){
|
||||
//invalid or unavailable
|
||||
alert('Name invalid or taken. Try again.');
|
||||
}else if(d.data === -1){
|
||||
//error
|
||||
alert('Unknown error. Contact Miodec on Discord.');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue