Using the existing code, hardcore code in an Admin account that is seperate from the regular user accounts. Only when logging in using the Admin account should the page should redirect you to sales.html Existing code: login.js function Login() { window.location.href = window.location.href.substring(0, window.location.href.lastIndexOf('/')) + "/Login.html" } function ResetPassword() { window.location.href = window.location.href.substring(0, window.location.href.lastIndexOf('/')) + "/resetpassword.html" } function LoginUser() { var userName = document.getElementById("txtUserName").value; var password = document.getElementById("txtPassword").value; var user = JSON.parse(localStorage.getItem("user")); var storedUserName = user.email; var storedPassword = user.password; if (storedUserName && storedPassword) { if (userName.length > 0 && password.length > 0) { if (userName == storedUserName && password == storedPassword) { alert("Logged In"); } else { alert("username or password does not match and try again"); } } else { alert("username or password should not be blank"); } } else { alert("username or password does not match and try again"); } }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Using the existing code, hardcore code in an Admin account that is seperate from the regular user accounts. Only when logging in using the Admin account should the page should redirect you to sales.html

Existing code:

login.js

function Login() {
window.location.href = window.location.href.substring(0, window.location.href.lastIndexOf('/')) + "/Login.html"
}

function ResetPassword() {
window.location.href = window.location.href.substring(0, window.location.href.lastIndexOf('/')) + "/resetpassword.html"
}


function LoginUser() {
var userName = document.getElementById("txtUserName").value;
var password = document.getElementById("txtPassword").value;

var user = JSON.parse(localStorage.getItem("user"));

var storedUserName = user.email;
var storedPassword = user.password;

if (storedUserName && storedPassword) {

if (userName.length > 0 && password.length > 0) {

if (userName == storedUserName && password == storedPassword) {
alert("Logged In");
} else {
alert("username or password does not match and try again");
}
} else {
alert("username or password should not be blank");
}
} else {
alert("username or password does not match and try again");
}
}

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY