From e222a079ead7d85b4ef2fc17f287c0334f34f741 Mon Sep 17 00:00:00 2001 From: Nicolas Seine Date: Tue, 28 May 2024 19:43:21 +0200 Subject: [PATCH 1/2] fix bug#5 : centering form on page --- src/styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles.css b/src/styles.css index 25969e5..0dbb1fd 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1,7 +1,7 @@ body { height: 100vh; display: flex; - /* TODO: Adjust CSS so that form is centered on page */ + justify-content: center; align-items: center; } From 081c34cc478e3c5823b84bbc2bc10ecb4bddaf6e Mon Sep 17 00:00:00 2001 From: Nicolas Seine Date: Fri, 31 May 2024 11:26:57 +0200 Subject: [PATCH 2/2] fixed all issues --- src/index.html | 13 ++++++------- src/script.js | 17 +++++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/index.html b/src/index.html index e7c4417..c120492 100644 --- a/src/index.html +++ b/src/index.html @@ -8,17 +8,16 @@
- - + - - + + - - - + + +
diff --git a/src/script.js b/src/script.js index 4e3be16..b8fbcaa 100644 --- a/src/script.js +++ b/src/script.js @@ -24,10 +24,15 @@ addEventListener("submit", (event) => { console.log(`email submitted: ${email}`); console.log(`password submitted: ${password}`); - /* - TODO: - 1. Check if the email and password are valid (using the usersTable) - 2. If they are, call renderSuccess() - 3. If they are not, call renderError() - */ + + const validUser = usersTable.find((user) => user.username === email); + if (validUser) { + if (validUser.password === password) { + renderSuccess(); + } else { + renderError(); + } + } else { + renderError(); + } });