From ec7ab04587397f6e9860d997c15be1facd848966 Mon Sep 17 00:00:00 2001 From: DDDrag0 Date: Sat, 23 Dec 2023 14:48:47 +0100 Subject: [PATCH 01/13] Updating registration front end and fixing interface --- .../service/registration/Registration.java | 9 - .../registration/RegistrationInterface.java | 15 - src/main/webapp/CSS/registration.css | 296 ++++++++++++++++++ src/main/webapp/JSP/registration.jsp | 59 ++++ .../webapp/images/registration/checkbox.svg | 4 + .../images/registration/checkboxcheck.svg | 4 + .../webapp/images/registration/icon-email.svg | 4 + .../images/registration/icon-eye-slash.svg | 8 + .../images/registration/icon-password.svg | 7 + .../images/registration/icon-user-outline.svg | 4 + 10 files changed, 386 insertions(+), 24 deletions(-) create mode 100644 src/main/webapp/CSS/registration.css create mode 100644 src/main/webapp/JSP/registration.jsp create mode 100644 src/main/webapp/images/registration/checkbox.svg create mode 100644 src/main/webapp/images/registration/checkboxcheck.svg create mode 100644 src/main/webapp/images/registration/icon-email.svg create mode 100644 src/main/webapp/images/registration/icon-eye-slash.svg create mode 100644 src/main/webapp/images/registration/icon-password.svg create mode 100644 src/main/webapp/images/registration/icon-user-outline.svg diff --git a/src/main/java/model/service/registration/Registration.java b/src/main/java/model/service/registration/Registration.java index e86bcff..aa4f4ab 100644 --- a/src/main/java/model/service/registration/Registration.java +++ b/src/main/java/model/service/registration/Registration.java @@ -32,14 +32,5 @@ public int register(String licenseCode, String email, String password, String na return 2; //email non valida } return 1; //licenza non valida - - } - - public boolean resetFromOldPassword(String email, String oldpw, String newpw) { - return false; - } - - public boolean resetPassword(String email) { - return false; } } diff --git a/src/main/java/model/service/registration/RegistrationInterface.java b/src/main/java/model/service/registration/RegistrationInterface.java index ca93604..1d632b5 100644 --- a/src/main/java/model/service/registration/RegistrationInterface.java +++ b/src/main/java/model/service/registration/RegistrationInterface.java @@ -14,19 +14,4 @@ public interface RegistrationInterface { * @return un codice di errore in base alla casistica */ int register(String licenseCode, String email, String password, String name, String surname); - - /** - * cambia la password da una vecchia a quella nuova - * @param email è l'email inserita dell'account - * @param oldpw è la password inserita da controllare la validità e sostituire - * @param newpw è la nuova password - * @return True se è stata cambiata con successo. False altrimenti - */ - boolean resetFromOldPassword(String email, String oldpw, String newpw); - - /** - * avvia il recupero password tramite email - * @param email è l'email inserita dell'account - * @return True se è stata cambiata con successo. False altrimenti - */ } \ No newline at end of file diff --git a/src/main/webapp/CSS/registration.css b/src/main/webapp/CSS/registration.css new file mode 100644 index 0000000..1474bd4 --- /dev/null +++ b/src/main/webapp/CSS/registration.css @@ -0,0 +1,296 @@ +@import url("https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"); +@import url("https://fonts.googleapis.com/css?family=Inter:400,700,600"); +* { + -webkit-font-smoothing: antialiased; + box-sizing: border-box; +} +html, +body { + margin: 0px; + height: 100%; +} +/* a blue color as a generic focus style */ +button:focus-visible { + outline: 2px solid #4a90e2 !important; + outline: -webkit-focus-ring-color auto 5px !important; +} +a { + text-decoration: none; +} + +:root { + --x-8a-36-5e: rgba(178, 34, 34, 1); + --fuschia-100: rgba(178, 34, 34, 1); + --fuschia-80: rgba(232, 29, 29, 1); + --fuschia-60: rgba(252, 221, 236, 1); + --iris-100: rgba(93, 95, 239, 1); + --iris-80: rgba(120, 121, 241, 1); + --iris-60: rgba(165, 166, 246, 1); + --header-1-font-family: "WorkSans-Bold", Helvetica; + --header-1-font-weight: 700; + --header-1-font-size: 34px; + --header-1-letter-spacing: -0.68px; + --header-1-line-height: normal; + --header-1-font-style: normal; + --header-2-font-family: "WorkSans-Bold", Helvetica; + --header-2-font-weight: 700; + --header-2-font-size: 20px; + --header-2-letter-spacing: -0.4px; + --header-2-line-height: normal; + --header-2-font-style: normal; + --body-font-family: "WorkSans-Regular", Helvetica; + --body-font-weight: 400; + --body-font-size: 13px; + --body-letter-spacing: -0.26px; + --body-line-height: normal; + --body-font-style: normal; + --jhjgjghj-font-family: "DroidSans-Regular", Helvetica; + --jhjgjghj-font-weight: 400; + --jhjgjghj-font-size: 14px; + --jhjgjghj-letter-spacing: 0px; + --jhjgjghj-line-height: 16px; + --jhjgjghj-font-style: normal; +} + +.element-registration { + background-color: #ffffff; + display: flex; + flex-direction: row; + justify-content: center; + width: 100%; +} + +.element-registration .div { + background-color: #ffffff; + overflow: hidden; + width: 375px; + height: 812px; + position: relative; +} + +.element-registration .hai-gi-un-account { + position: absolute; + top: 635px; + left: 91px; + font-family: "Inter", Helvetica; + font-weight: 400; + color: transparent; + font-size: 15px; + text-align: center; + line-height: 15px; +} + +.element-registration .text-wrapper { + color: #707684; + letter-spacing: 0.5px; + line-height: 22.5px; +} + +.element-registration .span { + color: #707684; + letter-spacing: 0; + line-height: 19.4px; +} + +.element-registration .text-wrapper-2 { + color: #199a8e; + letter-spacing: 0; + line-height: 22.5px; +} + +.element-registration .button { + position: absolute; + width: 327px; + height: 56px; + top: 552px; + left: 24px; + background-color: #199a8e; + border-radius: 32px; + box-sizing: border-box; +} + +.element-registration .text-wrapper-3 { + position: absolute; + top: 15px; + left: 133px; + font-family: "Inter", Helvetica; + font-weight: 600; + color: #ffffff; + font-size: 16px; + text-align: center; + letter-spacing: 0; + line-height: 24px; + white-space: nowrap; +} + +.element-registration .input-fields { + height: 256px; + top: 124px; + left: 24px; + position: absolute; + width: 327px; +} + +.element-registration .input { + position: absolute; + height: 56px; + top: 144px; + left: 0; + background-color: #f9f9fb; + border-radius: 24px; + border: 1px solid; + border-color: #e5e7eb; + width: 327px; +} + +.element-registration .input-2 { + position: absolute; + height: 56px; + top: 72px; + left: 0; + background-color: #f9f9fb; + border-radius: 24px; + border: 1px solid; + border-color: #e5e7eb; + width: 327px; +} + +.element-registration .input-3 { + position: absolute; + height: 56px; + top: 0; + left: 0; + background-color: #f9f9fb; + border-radius: 24px; + border: 1px solid; + border-color: #e5e7eb; + width: 327px; +} + +.element-registration .input-4 { + position: absolute; + height: 56px; + top: 216px; + left: 0; + background-color: #f9f9fb; + border-radius: 24px; + border: 1px solid; + border-color: #e5e7eb; + width: 327px; +} + +.element-registration .input-5 { + position: absolute; + height: 56px; + top: 288px; + left: 0; + background-color: #f9f9fb; + border-radius: 24px; + border: 1px solid; + border-color: #e5e7eb; + width: 327px; +} + +.element-registration .text-wrapper-4 { + position: absolute; + top: 14px; + left: 63px; + font-family: "Inter", Helvetica; + font-weight: 400; + color: #a0a7b0; + font-size: 16px; + letter-spacing: 0; + line-height: 24px; + white-space: nowrap; + background-color: #f9f9fb; + border: none; + outline: none; + -webkit-appearance: none; +} + +.element-registration .icon-eye-slash { + position: absolute; + width: 24px; + height: 24px; + top: 15px; + left: 278px; +} + +.element-registration .img { + position: absolute; + width: 24px; + height: 24px; + top: 15px; + left: 23px; +} + +.element-registration .terms-of-service { + position: absolute; + width: 329px; + height: 36px; + top: 278px; + left: 0; +} + +.element-registration .accetto-al { + position: absolute; + width: 287px; + top: 78px; + left: 40px; + font-family: "Inter", Helvetica; + font-weight: 400; + color: transparent; + font-size: 13px; + letter-spacing: 0; + line-height: 18.2px; +} + +.element-registration .text-wrapper-5 { + color: #3b4353; +} + +.element-registration .text-wrapper-6 { + color: #199a8e; +} + +.element-registration .checkbox { + position: absolute; + width: 24px; + height: 24px; + top: 78px; + left: 0; +} + +.element-registration .top-bar { + position: absolute; + width: 375px; + height: 100px; + top: -8px; + left: -1px; +} + +.element-registration .top { + position: relative; + width: 88px; + height: 24px; + top: 76px; + left: 145px; +} + +#myCheckbox:checked + label img { + content: url('../images/registration/checkboxcheck.svg'); +} + +.element-registration .text-wrapper-7 { + position: absolute; + top: 0; + left: 0; + font-family: "Inter", Helvetica; + font-weight: 700; + color: #101522; + font-size: 18px; + text-align: center; + letter-spacing: 0; + line-height: 24.3px; + white-space: nowrap; +} \ No newline at end of file diff --git a/src/main/webapp/JSP/registration.jsp b/src/main/webapp/JSP/registration.jsp new file mode 100644 index 0000000..0f758f8 --- /dev/null +++ b/src/main/webapp/JSP/registration.jsp @@ -0,0 +1,59 @@ + + + + + + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+

+ Accetto i seguenti + Termini di Servizio + di TalkAId e policy sulla + Privacy +

+ + +
+
+
+
Registrati
+
+
+
+
+ + diff --git a/src/main/webapp/images/registration/checkbox.svg b/src/main/webapp/images/registration/checkbox.svg new file mode 100644 index 0000000..3ad1d24 --- /dev/null +++ b/src/main/webapp/images/registration/checkbox.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/webapp/images/registration/checkboxcheck.svg b/src/main/webapp/images/registration/checkboxcheck.svg new file mode 100644 index 0000000..01a5657 --- /dev/null +++ b/src/main/webapp/images/registration/checkboxcheck.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/webapp/images/registration/icon-email.svg b/src/main/webapp/images/registration/icon-email.svg new file mode 100644 index 0000000..fd04671 --- /dev/null +++ b/src/main/webapp/images/registration/icon-email.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/webapp/images/registration/icon-eye-slash.svg b/src/main/webapp/images/registration/icon-eye-slash.svg new file mode 100644 index 0000000..86f5f7b --- /dev/null +++ b/src/main/webapp/images/registration/icon-eye-slash.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/main/webapp/images/registration/icon-password.svg b/src/main/webapp/images/registration/icon-password.svg new file mode 100644 index 0000000..6759a7a --- /dev/null +++ b/src/main/webapp/images/registration/icon-password.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/main/webapp/images/registration/icon-user-outline.svg b/src/main/webapp/images/registration/icon-user-outline.svg new file mode 100644 index 0000000..845e5d1 --- /dev/null +++ b/src/main/webapp/images/registration/icon-user-outline.svg @@ -0,0 +1,4 @@ + + + + From f3b821dbf1bf194e92e1a18a6bc72643d3739596 Mon Sep 17 00:00:00 2001 From: DDDrag0 Date: Sat, 23 Dec 2023 15:26:55 +0100 Subject: [PATCH 02/13] added checks and controls before entering the servlet --- src/main/webapp/JSP/registration.jsp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/webapp/JSP/registration.jsp b/src/main/webapp/JSP/registration.jsp index 0f758f8..e9bac23 100644 --- a/src/main/webapp/JSP/registration.jsp +++ b/src/main/webapp/JSP/registration.jsp @@ -16,23 +16,23 @@
- +
- +
- +
- +
- +
@@ -43,7 +43,7 @@ di TalkAId e policy sulla Privacy

- + From d26257ee10ee3a7314808a60b7156edaf3a8997e Mon Sep 17 00:00:00 2001 From: DDDrag0 Date: Sat, 23 Dec 2023 17:32:25 +0100 Subject: [PATCH 03/13] addition of the legal-post-registration part --- src/main/webapp/JSP/legal.jsp | 270 ++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 src/main/webapp/JSP/legal.jsp diff --git a/src/main/webapp/JSP/legal.jsp b/src/main/webapp/JSP/legal.jsp new file mode 100644 index 0000000..ae8c548 --- /dev/null +++ b/src/main/webapp/JSP/legal.jsp @@ -0,0 +1,270 @@ + + + + + Politica sulla Privacy + + + + +
+ + + + + + \ No newline at end of file From b6485a1f4d1f699b0ea838bff0ea2dcd3d8bf43a Mon Sep 17 00:00:00 2001 From: r-monti <127495690+r-monti@users.noreply.github.com> Date: Sun, 24 Dec 2023 11:19:58 +0100 Subject: [PATCH 04/13] Delete src/main/webapp/JavaScript directory Duplicate folder --- src/main/webapp/JavaScript/login.js | 51 ----------------------------- 1 file changed, 51 deletions(-) delete mode 100644 src/main/webapp/JavaScript/login.js diff --git a/src/main/webapp/JavaScript/login.js b/src/main/webapp/JavaScript/login.js deleted file mode 100644 index 5f6245c..0000000 --- a/src/main/webapp/JavaScript/login.js +++ /dev/null @@ -1,51 +0,0 @@ -$(document).ready(function startUp(){ - $("#showPassword").click(function (event){ - togglePassword(event); - - }); - $("#hidePassword").click(function (event){ - event.preventDefault(); - togglePassword(event); - }); - - $("#email").blur(function (){ - checkRegexEmail(); - }); - -}) - -function togglePassword(event){ - event.preventDefault(); - - const passwordField = $("#password"); - let passwordType = passwordField.attr('type'); - console.log(passwordType); - - if (passwordType === 'password') { - passwordField.attr("type", "text") - } else { - passwordField.attr("type", "password"); - } - - $("#showPassword").toggle() - $("#hidePassword").toggle() - - return NaN -} - -function checkRegexEmail(){ - const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; - const emailField = $("#email"); - - if(regex.test(emailField.val())){ - $("#validEmail").show() - $("#invalidEmail").hide() - - } - else{ - $("#validEmail").hide() - $("#invalidEmail").show() - } - - return NaN -} \ No newline at end of file From 1af0ae113b59463eaa1ec7f3b35c9874e254d316 Mon Sep 17 00:00:00 2001 From: "ms@Nicro" Date: Tue, 26 Dec 2023 12:18:00 +0100 Subject: [PATCH 05/13] Solved the visual bug and the icons bug. Still to fix: "Password Dimenticata" not working --- src/main/webapp/CSS/login.css | 4 ++ src/main/webapp/JS/login.js | 91 ++++++++++++++++++++++++++++------- src/main/webapp/JSP/login.jsp | 15 +++--- 3 files changed, 86 insertions(+), 24 deletions(-) diff --git a/src/main/webapp/CSS/login.css b/src/main/webapp/CSS/login.css index e8e9ed6..e908e28 100644 --- a/src/main/webapp/CSS/login.css +++ b/src/main/webapp/CSS/login.css @@ -26,6 +26,10 @@ a:hover { text-decoration: none; } +.hiddenClass{ + display: none; +} + #loginPage{ width: 100%; display: flex; diff --git a/src/main/webapp/JS/login.js b/src/main/webapp/JS/login.js index 06bf3cf..0554178 100644 --- a/src/main/webapp/JS/login.js +++ b/src/main/webapp/JS/login.js @@ -1,26 +1,45 @@ -// Extract the element identifiers as variables -let resetEmail = $("#resetEmail"); -let resetStep1 = $("#resetStep1"); -let resetStep2 = $("#resetStep2"); -let resetStep3 = $("#resetStep3"); -let resetPasswordModal = $('#resetPasswordModal'); -let newPassword = $("#newPassword"); -let repeatNewPassword = $("#repeatNewPassword"); -let resetButton = $("#resetPassword"); -let newPasswordError = $(".error"); -let contextPath = window.location.pathname.substring(0, window.location.pathname.indexOf("/",2)); +const resetEmail = $("#resetEmail"); +const resetStep1 = $("#resetStep1"); +const resetStep2 = $("#resetStep2"); +const resetStep3 = $("#resetStep3"); +const resetPasswordModal = $('#resetPasswordModal'); +const newPassword = $("#newPassword"); +const repeatNewPassword = $("#repeatNewPassword"); +const resetButton = $("#resetPassword"); +const newPasswordError = $(".error"); +const showPasswordIcon = $("#showPassword"); +const hidePasswordIcon = $("#hidePassword"); +const validEmailIcon = $("#validEmail"); +const invalidEmailIcon = $("#invalidEmail"); +const contextPath = window.location.pathname.substring(0, window.location.pathname.indexOf("/",2)); let THEPASSWORD; newPassword.on("input", validatePassword); repeatNewPassword.on("input", validatePassword); -$(document).ready(function () { +$(document).ready(function startUp() { + + showPasswordIcon.toggleClass("hiddenClass"); + + $("#showPassword").click((event) => { + event.preventDefault(); + togglePassword(event); + }); + + $("#hidePassword").click((event) => { + event.preventDefault(); + togglePassword(event); + }); + + $("#email").blur(() => { + checkRegexEmail(); + }); $("#forgotPassword").click(handleForgotPassword); - var sessionPin; - $("#sendPin").click(() => { + let sessionPin; + $("#sendPin").click((event) => { event.preventDefault(); $.post(`${contextPath}/login/reset`, {email: resetEmail.val()}, function(response) { sessionPin = response.trim(); // Save the response, which should be your pin @@ -29,7 +48,7 @@ $(document).ready(function () { }); }); - $("#confirmPin").click(() => { + $("#confirmPin").click((event) => { event.preventDefault(); if ($("#pin").val() === sessionPin) { // if the PIN entered matches the saved PIN, proceed to step 3 @@ -40,7 +59,7 @@ $(document).ready(function () { } }); - $("#resetPassword").click(function() { + $("#resetPassword").click(function(event) { event.preventDefault(); $.post(`${contextPath}/login/resetpassword`, { email: $("#resetEmail").val(), @@ -57,6 +76,44 @@ $(document).ready(function () { }); +function togglePassword(event) { + event.preventDefault(); + + const passwordField = $("#password"); + let passwordType = passwordField.attr('type'); + console.log(passwordType); + + if (passwordType === 'password') { + passwordField.attr("type", "text") + } else { + passwordField.attr("type", "password"); + } + + showPasswordIcon.toggleClass("hiddenClass") + hidePasswordIcon.toggleClass("hiddenClass") +} + +function checkRegexEmail(){ + const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/; + const emailField = $("#email"); + + if(regex.test(emailField.val())){ + if(validEmailIcon.hasClass("hiddenClass")){ + validEmailIcon.toggleClass("hiddenClass"); + } + if(!invalidEmailIcon.hasClass("hiddenClass")) { + invalidEmailIcon.toggleClass("hiddenClass"); + } + } else{ + if(!validEmailIcon.hasClass("hiddenClass")){ + validEmailIcon.toggleClass("hiddenClass"); + } + if(invalidEmailIcon.hasClass("hiddenClass")){ + invalidEmailIcon.toggleClass("hiddenClass"); + } + } +} + function handleForgotPassword(event) { event.preventDefault(); resetPasswordModal.modal('show'); @@ -88,7 +145,7 @@ function validatePassword() { showError("Le password non coincidono."); check2 = false; } - if (THEPASSWORD == confirmPassword) { + if (THEPASSWORD === confirmPassword) { showError(""); check2 = true; } diff --git a/src/main/webapp/JSP/login.jsp b/src/main/webapp/JSP/login.jsp index 2988ee1..ba918e8 100644 --- a/src/main/webapp/JSP/login.jsp +++ b/src/main/webapp/JSP/login.jsp @@ -18,20 +18,20 @@
- - + validEmail + invalidEmail

- emailIcon + passwordIcon
- - + +

@@ -73,9 +73,10 @@ - + + - + \ No newline at end of file From 5551ed5eb4633278c695e4e1819f35ece16dd70f Mon Sep 17 00:00:00 2001 From: DDDrag0 Date: Tue, 26 Dec 2023 16:48:32 +0100 Subject: [PATCH 06/13] added notification time lapse and checks --- src/main/webapp/JSP/legal.jsp | 241 ++++++++++++++++++++-------------- 1 file changed, 145 insertions(+), 96 deletions(-) diff --git a/src/main/webapp/JSP/legal.jsp b/src/main/webapp/JSP/legal.jsp index ae8c548..78362fb 100644 --- a/src/main/webapp/JSP/legal.jsp +++ b/src/main/webapp/JSP/legal.jsp @@ -4,9 +4,25 @@ Politica sulla Privacy