From 5470ffd3c567ce209196470cbc31794812a65081 Mon Sep 17 00:00:00 2001 From: Crypto-V Date: Tue, 6 Jun 2023 11:59:17 +0100 Subject: [PATCH] update the view of the registration --- pom.xml | 3 + .../view/RegistrationViewController.java | 14 ++-- src/main/resources/static/style.css | 4 ++ src/main/resources/templates/index.html | 24 +++++-- .../resources/templates/registration.html | 32 --------- src/main/resources/templates/signIn_form.html | 2 +- src/main/resources/templates/signUp_form.html | 65 +++++++++---------- src/main/resources/templates/welcome.html | 43 ------------ 8 files changed, 67 insertions(+), 120 deletions(-) delete mode 100644 src/main/resources/templates/registration.html diff --git a/pom.xml b/pom.xml index 07ef32d..70bbcc4 100644 --- a/pom.xml +++ b/pom.xml @@ -110,6 +110,7 @@ test + + + diff --git a/src/main/java/com/csaba79coder/littersnap/view/RegistrationViewController.java b/src/main/java/com/csaba79coder/littersnap/view/RegistrationViewController.java index 4165ab5..77ba9e1 100644 --- a/src/main/java/com/csaba79coder/littersnap/view/RegistrationViewController.java +++ b/src/main/java/com/csaba79coder/littersnap/view/RegistrationViewController.java @@ -2,7 +2,6 @@ import com.csaba79coder.littersnap.model.user.dto.UserRegistrationModel; import com.csaba79coder.littersnap.model.user.service.UserService; -import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -21,15 +20,18 @@ public class RegistrationViewController { @GetMapping("/registration") public String showRegistrationForm(Model model) { - model.addAttribute("userRegistrationModel", new UserRegistrationModel()); - return "registration"; + UserRegistrationModel tempModel = new UserRegistrationModel(); + model.addAttribute("userRegistrationModel", tempModel ); + model.addAttribute("view","signUp_form"); + return "index"; } @PostMapping("/registration") - public String registerUser(@ModelAttribute("userRegistrationModel") @Valid UserRegistrationModel registrationModel, + public String registerUser(@ModelAttribute("userRegistrationModel") UserRegistrationModel registrationModel, BindingResult bindingResult) { + if (bindingResult.hasErrors()) { - return "registration"; + return "signUp_form"; } // Create a User object from the registration model and save it using the UserService @@ -38,3 +40,5 @@ public String registerUser(@ModelAttribute("userRegistrationModel") @Valid UserR return "redirect:/index"; // Redirect to the index page after successful registration } } + + diff --git a/src/main/resources/static/style.css b/src/main/resources/static/style.css index 774be40..ab13bfd 100644 --- a/src/main/resources/static/style.css +++ b/src/main/resources/static/style.css @@ -24,6 +24,10 @@ body { z-index: 999; } +/*SignUp form*/ +.signup-form-container{ + max-width: 600px; +} /*Image redendering size controll*/ .image-container { max-width: 350px; /* Set the maximum width for the image container */ diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 422475a..eec458c 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -28,15 +28,27 @@ data-bs-target="#signInModal"> SignIn - + SignUp + + + +
+ + +
+
+
+ +
+
+ +
+
+
+
-
-
diff --git a/src/main/resources/templates/registration.html b/src/main/resources/templates/registration.html deleted file mode 100644 index 277df69..0000000 --- a/src/main/resources/templates/registration.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - Registration Form - - -

Registration Form

-
-
- - - -
-
- - - -
-
- - - -
-
- - - -
- -
- - diff --git a/src/main/resources/templates/signIn_form.html b/src/main/resources/templates/signIn_form.html index 80fc9d3..88fa609 100644 --- a/src/main/resources/templates/signIn_form.html +++ b/src/main/resources/templates/signIn_form.html @@ -24,7 +24,7 @@ SignIn
-

Don't have an account? Don't have an account? Sign Up

diff --git a/src/main/resources/templates/signUp_form.html b/src/main/resources/templates/signUp_form.html index 1b03301..a4665ed 100644 --- a/src/main/resources/templates/signUp_form.html +++ b/src/main/resources/templates/signUp_form.html @@ -1,39 +1,38 @@ -