mirror of
https://github.com/titanscouting/tra-analysis.git
synced 2024-12-27 09:59:10 +00:00
revamped profile page
This commit is contained in:
parent
c97e51d9bd
commit
f8dafe61f8
@ -24,23 +24,18 @@
|
||||
<span onclick="openNav()" id="topbar">
|
||||
<img id="sideload" src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/1200px-Hamburger_icon.svg.png">
|
||||
</span>
|
||||
<h1 id="mainhead">TitanScout- Sign In</h1>
|
||||
<h1 id="mainhead">TitanScout- Your Profile</h1>
|
||||
<p id="status">Loading...</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="profileupd">
|
||||
<div class="profupdopt">
|
||||
New Username: <input type="text" name="NewDN" value="" id="newDN">
|
||||
</div>
|
||||
<div class="profupdopt">
|
||||
New Profile Pic URL: <input type="text" name="NewPP" value="" id='newPP'>
|
||||
Username: <input type="text" name="NewDN" value="" id="newDN">
|
||||
<input type="button" name="upun" value="Update Username" onclick="updun();">
|
||||
</div>
|
||||
<div class="profileupdopt">
|
||||
New Email: <input type="text" name="NewEM" value="" id="newEM">
|
||||
</div>
|
||||
<div class="profileupdopt">
|
||||
<input type='button' name="upd" value="Update Profile" id="upd" onclick="upProfileInfo();">
|
||||
Email: <input type="text" name="NewEM" value="" id="newEM">
|
||||
<input type="button" name="updem" value="updem();">
|
||||
</div>
|
||||
</div>
|
||||
<div id="firebaseui-auth-container"></div>
|
||||
|
@ -22,12 +22,12 @@ window.onload = function() {
|
||||
storageBucket: "titanscoutandroid.appspot.com",
|
||||
messagingSenderId: "1097635313476"
|
||||
};
|
||||
//eventually find a less-jank way to do this tho
|
||||
firebase.initializeApp(config);
|
||||
firebase.auth().onAuthStateChanged(function(user) {
|
||||
if (user != null) {
|
||||
if (user.displayName != null) {
|
||||
document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName;
|
||||
document.getElementById('newDN').value = user.displayName;
|
||||
} else if (user.email != null) {
|
||||
document.getElementById('status').innerHTML = "You are signed in as: " + user.email;
|
||||
} else if (user.phoneNumber != null) {
|
||||
@ -35,8 +35,60 @@ window.onload = function() {
|
||||
} else {
|
||||
document.getElementById('status').innerHTML = "You are signed in.";
|
||||
}
|
||||
if (user.email != null) {
|
||||
document.getElementById('newEM').value = user.email;
|
||||
}
|
||||
} else {
|
||||
window.location.replace('../');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function signout() {
|
||||
var user = firebase.auth().currentUser;
|
||||
firebase.auth().signOut()
|
||||
window.location.href = '../';
|
||||
}
|
||||
|
||||
function deleteAccount() {
|
||||
try {
|
||||
firebase.auth().currentUser.delete()
|
||||
window.location.href = '../';
|
||||
} catch (error) {
|
||||
if (error.code == 'auth/requires-recent-login') {
|
||||
alert("Please sign in again to delete your account.")
|
||||
window.location.href = '../';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updun() {
|
||||
var user = firebase.auth().currentUser;
|
||||
user.updateProfile({
|
||||
displayName: document.getElementById('newDN').value,
|
||||
}).then(function() {
|
||||
document.getElementById('newDN').value = firebase.auth().currentUser.displayName;
|
||||
document.getElementById('status').innerHTML = "You are signed in as: " + firebase.auth().currentUser.displayName;
|
||||
}).catch(function(error) {
|
||||
alert("there was a problem: " + error)
|
||||
});
|
||||
}
|
||||
|
||||
function updem() {
|
||||
var user = firebase.auth().currentUser;
|
||||
user.updateEmail("user@example.com").then(function() {
|
||||
document.getElementById('newDN').value = firebase.auth().currentUser.email;
|
||||
if (user.displayName != null) {
|
||||
document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName;
|
||||
document.getElementById('newDN').value = user.displayName;
|
||||
} else if (user.email != null) {
|
||||
document.getElementById('status').innerHTML = "You are signed in as: " + user.email;
|
||||
}).catch(function(error) {
|
||||
if (error.code == 'auth/requires-recent-login') {
|
||||
alert("Please sign in again to delete your account.")
|
||||
window.location.href = '../';
|
||||
} else {
|
||||
alert("there was a problem: " + error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ var config = {
|
||||
firebase.initializeApp(config);
|
||||
// FirebaseUI config.
|
||||
var uiConfig = {
|
||||
signInSuccessUrl: '<url-to-redirect-to-on-success>',
|
||||
signInSuccessUrl: 'profile',
|
||||
signInOptions: [
|
||||
// Leave the lines as is for the providers you want to offer your users.
|
||||
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
|
||||
|
@ -3,16 +3,6 @@ body{
|
||||
text-align: center;
|
||||
font-family: 'Roboto', sans-serif;
|
||||
}
|
||||
#signout{
|
||||
display: none;
|
||||
}
|
||||
#deleteacc{
|
||||
display: none;
|
||||
}
|
||||
#updpi{
|
||||
display: none;
|
||||
}
|
||||
|
||||
#profileupd{
|
||||
display: none;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user