-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a40e78c
commit ae4ef56
Showing
4 changed files
with
71 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
|
||
<title>Home</title> | ||
</head> | ||
|
||
<body> | ||
<div class="cont ms-4"> | ||
<h1 id="greet"></h1> | ||
<h2 id="msg"></h2> | ||
<button type="button" class="btn btn-primary" id="signoutbutton">Log Out</button> | ||
</div> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" | ||
crossorigin="anonymous"></script> | ||
<script> | ||
let UserCreds = JSON.parse(sessionStorage.getItem('user-creds')); | ||
let UserInfo = JSON.parse(sessionStorage.getItem('user-info')); | ||
|
||
let msgHead = document.getElementById('msg'); | ||
let greetHead = document.getElementById('greet'); | ||
let signoutButton = document.getElementById('signoutbutton'); | ||
|
||
greetHead.innerText = `Welcome ${UserInfo.firstname}`; | ||
msgHead.innerText = `logged in with ${UserCreds.email}`; | ||
|
||
Signout = () => { | ||
sessionStorage.removeItem('user-creds'); | ||
sessionStorage.removeItem('user-info'); | ||
window.location.href = "login.html"; | ||
} | ||
|
||
chkCreds = () => { | ||
if (!sessionStorage.getItem('user-creds')) { | ||
window.location.href = "login.html"; | ||
} | ||
} | ||
window.addEventListener('load', chkCreds); | ||
signoutbutton.addEventListener('click', Signout); | ||
</script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,27 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<head> | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
|
||
<title>Home</title> | ||
</head> | ||
|
||
<body> | ||
<h1 id="greet"></h1> | ||
<h2 id="msg"></h2> | ||
|
||
<button type="button" class="btn btn-primary" id="signoutbutton">Log Out</button> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" | ||
crossorigin="anonymous"></script> | ||
<script> | ||
let UserCreds = JSON.parse(sessionStorage.getItem('user-creds')); | ||
let UserInfo = JSON.parse(sessionStorage.getItem('user-info')); | ||
|
||
let msgHead = document.getElementById('msg'); | ||
let greetHead = document.getElementById('greet'); | ||
let signoutButton = document.getElementById('signoutbutton'); | ||
<!-- Bootstrap CSS --> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> | ||
|
||
greetHead.innerHTML = `Welcome ${UserInfo.firstName}`; | ||
msgHead.innerHTML = `logged in with ${UserInfo.email}`; | ||
<title>Hello, world!</title> | ||
</head> | ||
<body> | ||
<h1>Hello, Click <a href="./register.html">here</a> to begin </h1> | ||
|
||
Signout = () => { | ||
sessionStorage.removeItem('user-creds'); | ||
sessionStorage.removeItem('user-info'); | ||
window.location.href = "login.html"; | ||
} | ||
<!-- Optional JavaScript; choose one of the two! --> | ||
|
||
chkCreds = () => { | ||
if (!sessionStorage.getItem('user-creds')) { | ||
window.location.href = "login.html"; | ||
} | ||
else { | ||
greetHead.innerHTML = `Welcome ${UserInfo.firstName}`; | ||
msgHead.innerHTML = `logged in with ${UserInfo.email}`; | ||
} | ||
} | ||
window.addEventListener('load', chkCreds); | ||
signoutbutton.addEventListener('click', Signout); | ||
</script> | ||
</body> | ||
<!-- Option 1: Bootstrap Bundle with Popper --> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> | ||
|
||
<!-- Option 2: Separate Popper and Bootstrap JS --> | ||
<!-- | ||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-7+zCNj/IqJ95wo16oMtfsKbZ9ccEh31eOz1HGyDuCQ6wgnyJNSYdrPa03rtR1zdB" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-QJHtvGhmr9XOIpI6YVutG+2QOK9T+ZnN4kzFN1RtK3zEFEIsxhlmWl5/YESvpZ13" crossorigin="anonymous"></script> | ||
--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters