Skip to content

Commit

Permalink
Merge pull request #42 from CIS-SoftwareDesign-S21/Leaderboard
Browse files Browse the repository at this point in the history
Leaderboard Update
  • Loading branch information
tuf50719 authored Apr 20, 2021
2 parents 4b477b6 + 959bbdf commit 46e4b85
Show file tree
Hide file tree
Showing 6 changed files with 2,029 additions and 62 deletions.
1,545 changes: 1,545 additions & 0 deletions firebasetest.html

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
<body>

<header>
<h1><a href="./" id="home-link">Genki Study Resources</a></h1>
<div style="display: flex;">
<h1><a href="./" id="home-link">Genki Study Resources</a></h1>
<h3 style="position: relative; margin-top: auto; margin-bottom: auto; margin-right: 10em; margin-left: auto;"><a style="color: #fff;" href="login.html">Login</a></h3>
</div>
<a id="fork-me" href="https://github.com/CIS-SoftwareDesign-S21/pro-04-study-resources">Fork Me</a>
</header>

Expand Down
213 changes: 213 additions & 0 deletions login.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">

<head>
<meta charset="UTF-8">
<title>Greetings | Genki Study Resources - 2nd Edition</title>
<meta name="title" content="Greetings | Genki Study Resources - 2nd Edition">
<meta name="twitter:title" content="Greetings | Genki Study Resources - 2nd Edition">
<meta property="og:title" content="Greetings | Genki Study Resources - 2nd Edition">
<meta name="description" content="Short clip with examples of the greetings in Genki I.">
<meta property="og:description" content="Short clip with examples of the greetings in Genki I.">
<link rel="shortcut icon" type="image/x-icon" href="resources/images/genkico.ico">

<meta name="keywords" content="Genki I, page 34, page 35, japanese, quizzes, exercises, 2nd Edition" lang="en">
<meta name="language" content="en">
<meta name="viewport" content="width=device-width, initial-scale=1">

<meta property="og:site_name" content="sethclydesdale.github.io">
<meta property="og:url"
content="https://cis-softwaredesign-s21.github.io/pro-04-study-resources/lessons/lesson-0/video-1/">
<meta property="og:type" content="website">
<meta property="og:image"
content="https://cis-softwaredesign-s21.github.io/pro-04-study-resources/resources/images/genki-thumb.png">
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@SethC1995">

<link rel="stylesheet" href="resources/css/stylesheet.min.css">
<script src="resources/javascript/head.min.js"></script>
<script src="resources/javascript/ga.js" async></script>
</head>

<body>

<header>
<h1><a href="index.html" id="home-link" class="edition-icon second-ed">Genki Study Resources</a></h1>
<a id="fork-me" href="https://github.com/CIS-SoftwareDesign-S21/pro-04-study-resources">Fork Me</a>
</header>

<div id="content" style="margin: auto; padding-top: 5%;" id="app">
<label for="uname"><b>Username</b></label>
<!--<input type="text" placeholder="Enter Username" name="uname" id="username" required>-->
<input type="text" placeholder="Enter Username" name="uname" id="email" required>

<br>
<br>

<label for="psw"><b>Password</b></label>
<!--<input type="password" placeholder="Enter Password" id="pass" name="psw" required>-->
<input type="password" placeholder="Enter Password" id="pass" name="psw" required>


<br>
<br>

<!--<button id="loginButton" onclick="console.log('why hello there; general kenobi')" type="submit"
style="text-align: center; margin: auto; display: flex;">Login</button> -->

<button id="loginButton" type="submit" style="text-align: center; margin: auto; display: flex;">Login</button>
<button id="registerButton" type="submit" style="text-align: center; margin: auto; display: flex;">Register</button>
<button id="profileButton" type="submit" style="text-align: center; margin: auto; display: flex;">View Profile</button>
<button id="logoutButton" type="submit" style="text-align: center; margin: auto; display: flex;">Logout</button>
<br>
<h3 id="welcome" style="text-align: center;"></h3>
</div>

<footer class="clear">
<ul class="footer-left">
<li><a href="../../../" id="footer-home">Home</a></li>
<li><a href="../../../privacy/">Privacy</a></li>
<li><a href="../../../report/">Report a Bug</a></li>
<li><a href="../../../help/">Help</a></li>
<li><a href="../../../donate/">Donate</a></li>
</ul>

<ul class="footer-right">
<li>Created by <a href="https://github.com/SethClydesdale">Seth Clydesdale</a> and the <a
href="https://github.com/SethClydesdale/genki-study-resources/graphs/contributors">GitHub
Community</a></li>
</ul>
</footer>
<script src="resources/javascript/all.min.js"></script>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-app.js"></script>

<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-database.js"></script>

<script>

var button = document.getElementById("loginButton");
var regBtn = document.getElementById("registerButton");
var logoutBtn = document.getElementById("logoutButton");
var profileBtn = document.getElementById("profileButton");
var user = document.getElementById("email");
var pw = document.getElementById("pass");
var msg = document.getElementById("welcome");

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "AIzaSyBqSV4gSe2UeRXUUTF_x-5jkT2oRbYrYqc",
authDomain: "genki-3a9db.firebaseapp.com",
databaseURL: "https://genki-3a9db-default-rtdb.firebaseio.com",
projectId: "genki-3a9db",
storageBucket: "genki-3a9db.appspot.com",
messagingSenderId: "664598827692",
appId: "1:664598827692:web:3dac59514d2d9c6d294509",
measurementId: "G-7BHYVJW7NF"
};

firebase.initializeApp(firebaseConfig);
firebase.analytics();

//Sign in
button.onclick = function(){
var email = user.value;
var password = pw.value;
firebase.auth().signInWithEmailAndPassword(email, password)
.then((userCredential) => {
// Signed in
var user = userCredential.user;
//console.log(user);
msg.innerHTML = 'Welome back ' + email;
// ...
})
.catch((error) => {
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode);

if (email === "" || password === "") {
msg.innerHTML = 'Email and Password Required';
}

else if(errorCode === 'auth/invalid-email' || errorCode === 'auth/wrong-password'){
msg.innerHTML = 'Invalid email or password';
}
else if(errorCode === 'auth/user-not-found'){
msg.innerHTML = 'Register your email'
}
else{
console.log("Try again");
}
});
}

//Register
regBtn.onclick = function(){
var email = user.value;
var password = pw.value;
firebase.auth().createUserWithEmailAndPassword(email, password)
.then((userCredential) => {
// Signed in
var user = userCredential.user;
msg.innerHTML = 'Welcome ' + email;
// ...
})
.catch((error) => {
var errorCode = error.code;
var errorMessage = error.message;
console.log(errorCode);
console.log(errorMessage);

if (email === "" || password === "") {
msg.innerHTML = 'Email and Password Required';
}

else if(errorCode === 'auth/email-already-in-use'){
msg.innerHTML = 'Email taken. Sign in?';
}

else if (errorCode === 'auth/weak-password'){
msg.innerHTML = 'Need at least 6 characters';
}
});
}

//Sign out
logoutBtn.onclick = function(){
firebase.auth().signOut().then(() => {
//console.log("logout sucessful");
msg.innerHTML = "Signed Out";
}).catch((error) => {
//console.log("Error");
msg.innerHTML = "Try Signing Out Again";
});
}

//Get user profile
profileBtn.onclick = function(){
var user = firebase.auth().currentUser;
if (user) {
// User is signed in.
// https://firebase.google.com/docs/reference/js/firebase.User
var email = user.email;
msg.innerHTML = email + ' profile';
} else {
// No user is signed in.
msg.innerHTML = 'No users signed in';
}
}

/*button.onclick = function(){ //For testing purposes
msg.innerHTML = "Welcome " + user.value;
};*/

</script>
</body>

</html>
72 changes: 72 additions & 0 deletions login/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8">
<title>Greetings | Genki Study Resources - 2nd Edition</title>
<meta name="title" content="Greetings | Genki Study Resources - 2nd Edition">
<meta name="twitter:title" content="Greetings | Genki Study Resources - 2nd Edition">
<meta property="og:title" content="Greetings | Genki Study Resources - 2nd Edition">
<meta name="description" content="Short clip with examples of the greetings in Genki I.">
<meta property="og:description" content="Short clip with examples of the greetings in Genki I.">
<link rel="shortcut icon" type="image/x-icon" href="../../../resources/images/genkico.ico">

<meta name="keywords" content="Genki I, page 34, page 35, japanese, quizzes, exercises, 2nd Edition" lang="en">
<meta name="language" content="en">
<meta name="viewport" content="width=device-width, initial-scale=1">

<meta property="og:site_name" content="sethclydesdale.github.io">
<meta property="og:url" content="https://cis-softwaredesign-s21.github.io/pro-04-study-resources/lessons/lesson-0/video-1/">
<meta property="og:type" content="website">
<meta property="og:image" content="https://cis-softwaredesign-s21.github.io/pro-04-study-resources/resources/images/genki-thumb.png">
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@SethC1995">

<link rel="stylesheet" href="../../../resources/css/stylesheet.min.css">
<script src="../../../resources/javascript/head.min.js"></script>
<script src="../../../resources/javascript/ga.js" async></script>
</head>

<body>

<header>
<h1><a href="../../../" id="home-link" class="edition-icon second-ed">Genki Study Resources</a></h1>
<a id="fork-me" href="https://github.com/CIS-SoftwareDesign-S21/pro-04-study-resources">Fork Me</a>
</header>

<div id="content" style="margin: auto; padding-top: 5%;">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>

<br>
<br>

<label for="psw"><b>Password</b></label>
<input type="password" style="font-size: 14px; font-family: 'メイリオ', Meiryo, Osaka, 'MS Pゴシック', 'MS PGothic', 'ヒラギノ角ゴ Pro W3', 'Hiragino Kaku Gothic Pro', Arial, sans-serif; background: #fff; border: 1px solid #ccc; padding: 6px; outline: 0;" placeholder="Enter Password" name="psw" required>

<br>
<br>

<button id="loginButton" onclick="console.log('why hello there; general kenobi')" type="submit" style="text-align: center; margin: auto; display: flex;">Login</button>
</div>

<footer class="clear">
<ul class="footer-left">
<li><a href="../../../" id="footer-home">Home</a></li>
<li><a href="../../../privacy/">Privacy</a></li>
<li><a href="../../../report/">Report a Bug</a></li>
<li><a href="../../../help/">Help</a></li>
<li><a href="../../../donate/">Donate</a></li>
</ul>

<ul class="footer-right">
<li>Created by <a href="https://github.com/SethClydesdale">Seth Clydesdale</a> and the <a href="https://github.com/SethClydesdale/genki-study-resources/graphs/contributors">GitHub Community</a></li>
</ul>
</footer>
<script src="../../../resources/javascript/all.min.js"></script>
<script>

var button = document.getElementById("loginButton");

</script>
</body>
</html>
Loading

0 comments on commit 46e4b85

Please sign in to comment.