Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkLoginStatus(page){
- username = sessionStorage.getItem("username");
- if (page == 'login') {
- if (username) {
- window.location.href = "dashboard.html";
- }
- }else if (page == 'dashboard') {
- if (!username) {
- window.location.href = "login.html";
- }else{
- $('#username').text(username);
- }
- }else{
- window.location.href = "login.html";
- }
- }
- function login(){
- var username = $('#username').val();
- var password = $('#password').val();
- if(password != '12341234'){
- alert('Password Wrong!!!');
- }else if(username != 'admin'){
- alert('Username not exist!!!');
- }else if (username == 'admin' && password == '12341234') {
- sessionStorage.setItem("username", "admin");
- window.location.href = "dashboard.html";
- }
- }
- function logout(){
- sessionStorage.removeItem("username");
- window.location.href = "login.html";
- }
Advertisement
Add Comment
Please, Sign In to add comment