mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-11-13 22:56:18 +00:00
reworked fix profile info
This commit is contained in:
parent
d9e7a1ed1e
commit
e554a1df99
@ -107,141 +107,97 @@ function loadupdpi() {
|
|||||||
|
|
||||||
function upProfileInfo() {
|
function upProfileInfo() {
|
||||||
if (firebase.auth().currentUser != null) {
|
if (firebase.auth().currentUser != null) {
|
||||||
var user = firebase.auth().currentUser;
|
var user = firebase.auth.currentUser;
|
||||||
if (document.getElementById('newDN').value != '') {
|
var newDN = document.getElementById('newDN').value;
|
||||||
user.updateProfile({
|
var newEM = document.getElementById('newEM').value;
|
||||||
displayName: document.getElementById('newDN').value
|
var newPP = document.getElementById('newPP').value;
|
||||||
}).then(function() {
|
var si = true
|
||||||
if (document.getElementById('newPP').value != '') {
|
if (newDN != '' && newDN != user.displayName) {
|
||||||
|
if (newPP != '' && newPP != user.photoURL) {
|
||||||
|
try {
|
||||||
user.updateProfile({
|
user.updateProfile({
|
||||||
photoURL: document.getElementById('newPP').value
|
displayName: newDN,
|
||||||
}).then(function() {
|
photoURL: newPP
|
||||||
if (document.getElementById('newEM').value != '') {
|
|
||||||
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
|
||||||
handleSignedInUser();
|
|
||||||
}).catch(function(error) {
|
|
||||||
if (error.code == 'auth/requires-recent-login') {
|
|
||||||
// The user's credential is too old. She needs to sign in again.
|
|
||||||
signout()
|
|
||||||
// The timeout allows the message to be displayed after the UI has
|
|
||||||
// changed to the signed out state.
|
|
||||||
setTimeout(function() {
|
|
||||||
alert('Please sign in again to change your account info.');
|
|
||||||
}, 1);
|
|
||||||
} else {
|
|
||||||
alert("An Error Occurred: " +error)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
handleSignedInUser();
|
|
||||||
}
|
|
||||||
}).catch(function(error) {
|
|
||||||
if (error.code == 'auth/requires-recent-login') {
|
|
||||||
// The user's credential is too old. She needs to sign in again.
|
|
||||||
signout()
|
|
||||||
// The timeout allows the message to be displayed after the UI has
|
|
||||||
// changed to the signed out state.
|
|
||||||
setTimeout(function() {
|
|
||||||
alert('Please sign in again to change your account info.');
|
|
||||||
}, 1);
|
|
||||||
} else {
|
|
||||||
alert("An Error Occurred: " +error)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} catch (error) {
|
||||||
if (document.getElementById('newEM').value != '') {
|
if (error.code == 'auth/requires-recent-login') {
|
||||||
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
si = false;
|
||||||
handleSignedInUser();
|
// The user's credential is too old. She needs to sign in again.
|
||||||
}).catch(function(error) {
|
signout()
|
||||||
if (error.code == 'auth/requires-recent-login') {
|
// The timeout allows the message to be displayed after the UI has
|
||||||
// The user's credential is too old. She needs to sign in again.
|
// changed to the signed out state.
|
||||||
signout()
|
setTimeout(function() {
|
||||||
// The timeout allows the message to be displayed after the UI has
|
alert('Please sign in again to delete your account.');
|
||||||
// changed to the signed out state.
|
}, 1);
|
||||||
setTimeout(function() {
|
|
||||||
alert('Please sign in again to change your account info.');
|
|
||||||
}, 1);
|
|
||||||
} else {
|
|
||||||
alert("An Error Occurred: " +error)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
handleSignedInUser();
|
alert("An error occurred: " + error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(function(error) {
|
} else {
|
||||||
|
try {
|
||||||
|
user.updateProfile({
|
||||||
|
displayName: newDN
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code == 'auth/requires-recent-login') {
|
||||||
|
si = false;
|
||||||
|
// The user's credential is too old. She needs to sign in again.
|
||||||
|
signout()
|
||||||
|
// The timeout allows the message to be displayed after the UI has
|
||||||
|
// changed to the signed out state.
|
||||||
|
setTimeout(function() {
|
||||||
|
alert('Please sign in again to delete your account.');
|
||||||
|
}, 1);
|
||||||
|
} else {
|
||||||
|
alert("An error occurred: " + error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (newPP != '' && newPP != user.photoURL) {
|
||||||
|
try {
|
||||||
|
user.updateProfile({
|
||||||
|
photoURL: newPP
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
if (error.code == 'auth/requires-recent-login') {
|
||||||
|
si = false;
|
||||||
|
// The user's credential is too old. She needs to sign in again.
|
||||||
|
signout()
|
||||||
|
// The timeout allows the message to be displayed after the UI has
|
||||||
|
// changed to the signed out state.
|
||||||
|
setTimeout(function() {
|
||||||
|
alert('Please sign in again to delete your account.');
|
||||||
|
}, 1);
|
||||||
|
} else {
|
||||||
|
alert("An error occurred: " + error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (newEM != '' && newEM != user.email) {
|
||||||
|
try {
|
||||||
|
user.updateEmail(newEM)
|
||||||
|
} catch (error) {
|
||||||
|
si = false;
|
||||||
if (error.code == 'auth/requires-recent-login') {
|
if (error.code == 'auth/requires-recent-login') {
|
||||||
// The user's credential is too old. She needs to sign in again.
|
// The user's credential is too old. She needs to sign in again.
|
||||||
signout()
|
signout()
|
||||||
// The timeout allows the message to be displayed after the UI has
|
// The timeout allows the message to be displayed after the UI has
|
||||||
// changed to the signed out state.
|
// changed to the signed out state.
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
alert('Please sign in again to change your account info.');
|
alert('Please sign in again to delete your account.');
|
||||||
}, 1);
|
}, 1);
|
||||||
} else {
|
} else {
|
||||||
alert("An Error Occurred: " +error)
|
alert("An error occurred: " + error)
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (document.getElementById('newPP').value != '') {
|
|
||||||
user.updateProfile({
|
|
||||||
photoURL: document.getElementById('newPP').value
|
|
||||||
}).then(function() {
|
|
||||||
if (document.getElementById('newEM').value != '') {
|
|
||||||
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
|
||||||
handleSignedInUser();
|
|
||||||
}).catch(function(error) {
|
|
||||||
if (error.code == 'auth/requires-recent-login') {
|
|
||||||
// The user's credential is too old. She needs to sign in again.
|
|
||||||
signout()
|
|
||||||
// The timeout allows the message to be displayed after the UI has
|
|
||||||
// changed to the signed out state.
|
|
||||||
setTimeout(function() {
|
|
||||||
alert('Please sign in again to change your account info.');
|
|
||||||
}, 1);
|
|
||||||
} else {
|
|
||||||
alert("An Error Occurred: " +error)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
handleSignedInUser();
|
|
||||||
}
|
|
||||||
}).catch(function(error) {
|
|
||||||
if (error.code == 'auth/requires-recent-login') {
|
|
||||||
// The user's credential is too old. She needs to sign in again.
|
|
||||||
signout()
|
|
||||||
// The timeout allows the message to be displayed after the UI has
|
|
||||||
// changed to the signed out state.
|
|
||||||
setTimeout(function() {
|
|
||||||
alert('Please sign in again to change your account info.');
|
|
||||||
}, 1);
|
|
||||||
} else {
|
|
||||||
alert("An Error Occurred: " +error)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (document.getElementById('newEM').value != '') {
|
|
||||||
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
|
||||||
handleSignedInUser();
|
|
||||||
}).catch(function(error) {
|
|
||||||
if (error.code == 'auth/requires-recent-login') {
|
|
||||||
// The user's credential is too old. She needs to sign in again.
|
|
||||||
signout()
|
|
||||||
// The timeout allows the message to be displayed after the UI has
|
|
||||||
// changed to the signed out state.
|
|
||||||
setTimeout(function() {
|
|
||||||
alert('Please sign in again to change your account info.');
|
|
||||||
}, 1);
|
|
||||||
} else {
|
|
||||||
alert("An Error Occurred: " +error)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
handleSignedInUser();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
if (si) {
|
||||||
|
handleSignedInUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
alert('Please sign in to change your account info.');
|
alert('Please sign in to change your account info.');
|
||||||
}, 1);
|
}, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user