|
@@ -57,11 +57,7 @@
|
|
|
const btnLogout = `
|
|
|
<button class="btn btn-logout" onclick="logout()">Logout</button>
|
|
|
`;
|
|
|
- const credentials = [
|
|
|
- { login: "test1", password: "test1" },
|
|
|
- { login: "test2", password: "test3" },
|
|
|
- { login: "test3", password: "test2" },
|
|
|
- ];
|
|
|
+ const credentials = { login: "admin", password: "qwerty" };
|
|
|
|
|
|
document.querySelector(".container-form").innerHTML = "loading...";
|
|
|
fetch("https://open.er-api.com/v6/latest/USD", {
|
|
@@ -99,9 +95,11 @@
|
|
|
e.preventDefault();
|
|
|
let login = e.target.elements.login.value;
|
|
|
let password = e.target.elements.password.value;
|
|
|
- let accountCredentials = credentials.filter((el) => el.login === login)[0];
|
|
|
|
|
|
- if (!accountCredentials || accountCredentials?.password !== password) {
|
|
|
+ login ? removeError("Login is required") : addError("Login is required");
|
|
|
+ password ? removeError("Password is required") : addError("Password is required");
|
|
|
+
|
|
|
+ if (credentials.login !== login || credentials.password !== password) {
|
|
|
localStorage.setItem("isAuth", false);
|
|
|
addError("The username or password is incorrect");
|
|
|
return;
|