revamped sign-in, now that we have working checks

This commit is contained in:
Jacob Levine
2019-02-09 13:57:48 -06:00
parent 2c9951d2c9
commit 059509e018
8 changed files with 63 additions and 229 deletions

View File

@@ -14,7 +14,7 @@
<body>
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
<a href="../">Profile</a>
<a href="../profile">Profile</a>
<a href="#">Team</a>
<a href="../scout">Scout Matches</a>
<a href="../stats">Torunament Stats</a>
@@ -24,6 +24,7 @@
<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- Your Teams</h1>
<p id="status">Loading...</p>
</div>
</body>
</html>

View File

@@ -12,6 +12,31 @@ function closeNav() {
document.body.style.backgroundColor = "white";
}
window.onload=function(){
window.onload = function() {
document.getElementById('sideload').style.display = 'block';
var config = {
apiKey: "(insert the TitanScout Api Key Here)",
authDomain: "titanscoutandroid.firebaseapp.com",
databaseURL: "https://titanscoutandroid.firebaseio.com",
projectId: "titanscoutandroid",
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;
} else if (user.email != null) {
document.getElementById('status').innerHTML = "You are signed in as: " + user.email;
} else if (user.phoneNumber != null) {
document.getElementById('status').innerHTML = "You are signed in as: " + user.phoneNumber;
} else {
document.getElementById('status').innerHTML = "You are signed in.";
}
} else {
window.location.replace('../');
}
});
}