added profile change functionality

This commit is contained in:
Jacob Levine 2019-02-06 13:24:56 -06:00
parent 1293de346e
commit f195b81974
3 changed files with 25 additions and 0 deletions

View File

@ -14,7 +14,13 @@
<h1 id="mainhead">TitanScout- Sign In</h1>
<p id="status">You are not signed in.</p>
<input type="button" name="Sign Out" value="Sign Out" onclick="signout();" id="signout">
<input type="button" name="Update Profile" onClick="loadupdpi();" value='Update Profile Info' id="updpi">
<input type="button" name="DelAcc" value="Delete Account" onclick="deleteAccount();" id="deleteacc">
<div id="ProfileUpdate">
New Username: <input type="text" name="NewDN" value="" id="newDN">
New Profile Pic URL: <input type="text" name="NewPP" value="" id='newPP'>
New Email: <input type="text" name="NewEM" value="" id="newEM">
</div>
<div id="firebaseui-auth-container"></div>
</body>
</html>

View File

@ -50,12 +50,14 @@ var handleSignedInUser = function(user) {
document.getElementById('status').innerHTML = "You are signed in.";
}
document.getElementById('signout').style.display='inline-block';
document.getElementById('updpi').style.display='inline-block';
document.getElementById('deleteacc').style.display='inline-block';
}
var handleSignedOutUser = function() {
document.getElementById("mainhead").innerHTML = "TitanScout- Sign In";
document.getElementById('status').innerHTML = "You are not signed in.";
document.getElementById('signout').style.display='none';
document.getElementById('updpi').style.display='none';
document.getElementById('deleteacc').style.display='none';
ui.start('#firebaseui-auth-container', uiConfig);
};
@ -86,3 +88,13 @@ function signout() {
firebase.auth().signOut()
handleSignedOutUser()
}
function loadupdpi(){
if(firebase.auth().currentUser != null){
document.getElementById('ProfileUpdate').display='block';
}else {
setTimeout(function() {
alert('Please sign in to change your account info.');
}, 1);
handleSignedOutUser();
}
}

View File

@ -9,3 +9,10 @@ body{
#deleteacc{
display: none;
}
#updpi{
display: none;
}
#ProfileUpdate{
display: none;
}