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">
|
<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">
|
<img id="sideload" src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/1200px-Hamburger_icon.svg.png">
|
||||||
</span>
|
</span>
|
||||||
<h1 id="mainhead">TitanScout- Sign In</h1>
|
<h1 id="mainhead">TitanScout- Your Profile</h1>
|
||||||
<p id="status">Loading...</p>
|
<p id="status">Loading...</p>
|
||||||
<input type="button" name="Sign Out" value="Sign Out" onclick="signout();" id="signout">
|
<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">
|
<input type="button" name="DelAcc" value="Delete Account" onclick="deleteAccount();" id="deleteacc">
|
||||||
<div id="profileupd">
|
<div id="profileupd">
|
||||||
<div class="profupdopt">
|
<div class="profupdopt">
|
||||||
New Username: <input type="text" name="NewDN" value="" id="newDN">
|
Username: <input type="text" name="NewDN" value="" id="newDN">
|
||||||
</div>
|
<input type="button" name="upun" value="Update Username" onclick="updun();">
|
||||||
<div class="profupdopt">
|
|
||||||
New Profile Pic URL: <input type="text" name="NewPP" value="" id='newPP'>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="profileupdopt">
|
<div class="profileupdopt">
|
||||||
New Email: <input type="text" name="NewEM" value="" id="newEM">
|
Email: <input type="text" name="NewEM" value="" id="newEM">
|
||||||
</div>
|
<input type="button" name="updem" value="updem();">
|
||||||
<div class="profileupdopt">
|
|
||||||
<input type='button' name="upd" value="Update Profile" id="upd" onclick="upProfileInfo();">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="firebaseui-auth-container"></div>
|
<div id="firebaseui-auth-container"></div>
|
||||||
|
@ -22,12 +22,12 @@ window.onload = function() {
|
|||||||
storageBucket: "titanscoutandroid.appspot.com",
|
storageBucket: "titanscoutandroid.appspot.com",
|
||||||
messagingSenderId: "1097635313476"
|
messagingSenderId: "1097635313476"
|
||||||
};
|
};
|
||||||
//eventually find a less-jank way to do this tho
|
|
||||||
firebase.initializeApp(config);
|
firebase.initializeApp(config);
|
||||||
firebase.auth().onAuthStateChanged(function(user) {
|
firebase.auth().onAuthStateChanged(function(user) {
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
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;
|
||||||
|
document.getElementById('newDN').value = 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) {
|
||||||
@ -35,8 +35,60 @@ window.onload = function() {
|
|||||||
} else {
|
} else {
|
||||||
document.getElementById('status').innerHTML = "You are signed in.";
|
document.getElementById('status').innerHTML = "You are signed in.";
|
||||||
}
|
}
|
||||||
|
if (user.email != null) {
|
||||||
|
document.getElementById('newEM').value = user.email;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
window.location.replace('../');
|
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);
|
firebase.initializeApp(config);
|
||||||
// FirebaseUI config.
|
// FirebaseUI config.
|
||||||
var uiConfig = {
|
var uiConfig = {
|
||||||
signInSuccessUrl: '<url-to-redirect-to-on-success>',
|
signInSuccessUrl: 'profile',
|
||||||
signInOptions: [
|
signInOptions: [
|
||||||
// Leave the lines as is for the providers you want to offer your users.
|
// Leave the lines as is for the providers you want to offer your users.
|
||||||
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
|
firebase.auth.GoogleAuthProvider.PROVIDER_ID,
|
||||||
|
@ -3,16 +3,6 @@ body{
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-family: 'Roboto', sans-serif;
|
font-family: 'Roboto', sans-serif;
|
||||||
}
|
}
|
||||||
#signout{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#deleteacc{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
#updpi{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profileupd{
|
#profileupd{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user