mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-27 01:59:08 +00:00
bugfix
This commit is contained in:
parent
c591c84c75
commit
dc80127dee
@ -10,8 +10,8 @@ var config = {
|
|||||||
firebase.initializeApp(config);
|
firebase.initializeApp(config);
|
||||||
// FirebaseUI config.
|
// FirebaseUI config.
|
||||||
var uiConfig = {
|
var uiConfig = {
|
||||||
callbacks:{
|
callbacks: {
|
||||||
signInSuccessWithAuthResult:function(authResult, redirectUrl) {
|
signInSuccessWithAuthResult: function(authResult, redirectUrl) {
|
||||||
if (authResult.user) {
|
if (authResult.user) {
|
||||||
handleSignedInUser(authResult.user);
|
handleSignedInUser(authResult.user);
|
||||||
}
|
}
|
||||||
@ -27,12 +27,14 @@ var uiConfig = {
|
|||||||
firebase.auth.GithubAuthProvider.PROVIDER_ID,
|
firebase.auth.GithubAuthProvider.PROVIDER_ID,
|
||||||
firebase.auth.EmailAuthProvider.PROVIDER_ID,
|
firebase.auth.EmailAuthProvider.PROVIDER_ID,
|
||||||
firebase.auth.PhoneAuthProvider.PROVIDER_ID,
|
firebase.auth.PhoneAuthProvider.PROVIDER_ID,
|
||||||
// firebaseui.auth.AnonymousAuthProvider.PROVIDER_ID
|
// firebaseui.auth.AnonymousAuthProvider.PROVIDER_ID
|
||||||
],
|
],
|
||||||
// tosUrl and privacyPolicyUrl accept either url string or a callback
|
// tosUrl and privacyPolicyUrl accept either url string or a callback
|
||||||
// function.
|
// function.
|
||||||
// Terms of service url/callback.
|
// Terms of service url/callback.
|
||||||
tosUrl: function(){alert("this is a test app. don't use it");},
|
tosUrl: function() {
|
||||||
|
alert("this is a test app. don't use it");
|
||||||
|
},
|
||||||
// Privacy policy url/callback.
|
// Privacy policy url/callback.
|
||||||
privacyPolicyUrl: function() {
|
privacyPolicyUrl: function() {
|
||||||
alert("we will steal all of the data");
|
alert("we will steal all of the data");
|
||||||
@ -40,27 +42,27 @@ var uiConfig = {
|
|||||||
};
|
};
|
||||||
var handleSignedInUser = function(user) {
|
var handleSignedInUser = function(user) {
|
||||||
document.getElementById("mainhead").innerHTML = "TitanScout- Create Form";
|
document.getElementById("mainhead").innerHTML = "TitanScout- Create Form";
|
||||||
if (user.displayName != null){
|
if (user.displayName != null) {
|
||||||
document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName;
|
document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName;
|
||||||
}else if (user.email != null) {
|
} else if (user.email != null) {
|
||||||
document.getElementById('status').innerHTML = "You are signed in as: " + user.email;
|
document.getElementById('status').innerHTML = "You are signed in as: " + user.email;
|
||||||
}else if (user.phoneNumber != null) {
|
} else if (user.phoneNumber != null) {
|
||||||
document.getElementById('status').innerHTML = "You are signed in as: " + user.phoneNumber;
|
document.getElementById('status').innerHTML = "You are signed in as: " + user.phoneNumber;
|
||||||
}else{
|
} else {
|
||||||
document.getElementById('status').innerHTML = "You are signed in.";
|
document.getElementById('status').innerHTML = "You are signed in.";
|
||||||
}
|
}
|
||||||
document.getElementById('signout').style.display='inline-block';
|
document.getElementById('signout').style.display = 'inline-block';
|
||||||
document.getElementById('updpi').style.display='inline-block';
|
document.getElementById('updpi').style.display = 'inline-block';
|
||||||
document.getElementById('deleteacc').style.display='inline-block';
|
document.getElementById('deleteacc').style.display = 'inline-block';
|
||||||
document.getElementById('profileupd').style.display='none';
|
document.getElementById('profileupd').style.display = 'none';
|
||||||
}
|
}
|
||||||
var handleSignedOutUser = function() {
|
var handleSignedOutUser = function() {
|
||||||
document.getElementById("mainhead").innerHTML = "TitanScout- Sign In";
|
document.getElementById("mainhead").innerHTML = "TitanScout- Sign In";
|
||||||
document.getElementById('status').innerHTML = "You are not signed in.";
|
document.getElementById('status').innerHTML = "You are not signed in.";
|
||||||
document.getElementById('signout').style.display='none';
|
document.getElementById('signout').style.display = 'none';
|
||||||
document.getElementById('updpi').style.display='none';
|
document.getElementById('updpi').style.display = 'none';
|
||||||
document.getElementById('deleteacc').style.display='none';
|
document.getElementById('deleteacc').style.display = 'none';
|
||||||
document.getElementById('profileupd').style.display='none';
|
document.getElementById('profileupd').style.display = 'none';
|
||||||
ui.start('#firebaseui-auth-container', uiConfig);
|
ui.start('#firebaseui-auth-container', uiConfig);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -77,165 +79,171 @@ var deleteAccount = function() {
|
|||||||
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 delete your account.');
|
alert('Please sign in again to delete your account.');
|
||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function signout() {
|
function signout() {
|
||||||
var user = firebase.auth().currentUser;
|
var user = firebase.auth().currentUser;
|
||||||
firebase.auth().signOut()
|
firebase.auth().signOut()
|
||||||
handleSignedOutUser()
|
handleSignedOutUser()
|
||||||
}
|
}
|
||||||
function loadupdpi(){
|
|
||||||
if(firebase.auth().currentUser != null){
|
function loadupdpi() {
|
||||||
document.getElementById('profileupd').style.display='block';
|
if (firebase.auth().currentUser != null) {
|
||||||
}else {
|
document.getElementById('profileupd').style.display = 'block';
|
||||||
|
} 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);
|
||||||
handleSignedOutUser();
|
handleSignedOutUser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function upProfileInfo() {
|
function upProfileInfo() {
|
||||||
if(firebase.auth().currentUser != null){
|
if (firebase.auth().currentUser != null) {
|
||||||
if(document.getElementById('newDN').value != ''){
|
if (document.getElementById('newDN').value != '') {
|
||||||
user.updateProfile({
|
user.updateProfile({
|
||||||
displayName: document.getElementById('newDN').value
|
displayName: document.getElementById('newDN').value
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
if (document.getElementById('newPP').value != '') {
|
if (document.getElementById('newPP').value != '') {
|
||||||
user.updateProfile({
|
user.updateProfile({
|
||||||
photoURL: document.getElementById('newPP').value
|
photoURL: document.getElementById('newPP').value
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
if(document.getElementById('newEM').value != ''){
|
if (document.getElementById('newEM').value != '') {
|
||||||
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
||||||
handleSignedInUser();
|
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.code)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
handleSignedInUser();
|
|
||||||
}
|
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
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 change your account info.');
|
||||||
}, 1);
|
}, 1);
|
||||||
} else {
|
} else {
|
||||||
alert("An Error Occurred: "+error.code)
|
alert("An Error Occurred: " + error.code)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
if(document.getElementById('newEM').value != ''){
|
|
||||||
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
|
||||||
handleSignedInUser();
|
handleSignedInUser();
|
||||||
}).catch(function(error) {
|
}
|
||||||
if (error.code == 'auth/requires-recent-login') {
|
}).catch(function(error) {
|
||||||
// The user's credential is too old. She needs to sign in again.
|
if (error.code == 'auth/requires-recent-login') {
|
||||||
signout()
|
// The user's credential is too old. She needs to sign in again.
|
||||||
// The timeout allows the message to be displayed after the UI has
|
signout()
|
||||||
// changed to the signed out state.
|
// The timeout allows the message to be displayed after the UI has
|
||||||
setTimeout(function() {
|
// changed to the signed out state.
|
||||||
alert('Please sign in again to change your account info.');
|
setTimeout(function() {
|
||||||
}, 1);
|
alert('Please sign in again to change your account info.');
|
||||||
} else {
|
}, 1);
|
||||||
alert("An Error Occurred: "+error.code)
|
} else {
|
||||||
}
|
alert("An Error Occurred: " + error.code)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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.code)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
handleSignedInUser();}
|
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.code)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} 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.code)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
handleSignedInUser();
|
||||||
}
|
}
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
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 change your account info.');
|
||||||
}, 1);
|
}, 1);
|
||||||
} else {
|
} else {
|
||||||
alert("An Error Occurred: "+error.code)
|
alert("An Error Occurred: " + error.code)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
if (document.getElementById('newPP').value != '') {
|
if (document.getElementById('newEM').value != '') {
|
||||||
user.updateProfile({
|
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
||||||
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.code)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}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.code)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
if(document.getElementById('newEM').value != ''){
|
|
||||||
user.updateEmail(document.getElementById('newEM').value).then(function() {
|
|
||||||
handleSignedInUser();
|
handleSignedInUser();
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
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 change your account info.');
|
||||||
}, 1);
|
}, 1);
|
||||||
} else {
|
} else {
|
||||||
alert("An Error Occurred: "+error.code)
|
alert("An Error Occurred: " + error.code)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
handleSignedInUser();}
|
handleSignedInUser();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}else {
|
}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);
|
||||||
handleSignedOutUser();
|
handleSignedOutUser();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user