Skip to content

Commit 597b59d

Browse files
committed
fix: broken registration page
Motivation: Registration page is broken because the 'user' object is not initialized to an empty user when showing the form. Modifications: Properly initialize the 'user' object when showing the registration form. Result: The form works (note: the form doesn't actually create new users, as expected).
1 parent 63e885e commit 597b59d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/main/java/io/gatling/demostore/website/controllers/RegistrationController.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22

33
import javax.validation.Valid;
44

5-
import io.gatling.demostore.models.UserRepository;
65
import io.gatling.demostore.models.data.User;
76

8-
import org.springframework.beans.factory.annotation.Autowired;
9-
import org.springframework.security.crypto.password.PasswordEncoder;
107
import org.springframework.stereotype.Controller;
118
import org.springframework.ui.Model;
129
import org.springframework.validation.BindingResult;
@@ -19,7 +16,8 @@
1916
public class RegistrationController {
2017

2118
@GetMapping
22-
public String register() {
19+
public String register(Model model) {
20+
model.addAttribute("user", new User());
2321
return "register";
2422
}
2523

0 commit comments

Comments
 (0)