/**
 * 
 */
package securbank.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;

import securbank.models.User;
import securbank.services.UserService;
import securbank.validators.ExternalUserFormValidator;
/**
 * @author Ayush Gupta
 *
 */
@Controller
public class ExternalUserController {
	@Autowired
	UserService userService;
	
	@Autowired 
	ExternalUserFormValidator userFormValidator;
	
	@GetMapping("/signup")
    public String signupForm(Model model) {
		model.addAttribute("user", new User());
        return "signup";
    }
		
	@PostMapping("/signup")
    public String signupSubmit(@ModelAttribute User user, BindingResult bindingResult) {
		userFormValidator.validate(user, bindingResult);
		if (bindingResult.hasErrors()) {
			return "signup";
        }
		
    	userService.createInternalUser(user);
        return "redirect:/";
    }
}

@@ -1135,10 +1135,10 @@
 eate
-In
+Ex
 tern
@@ -1151,16 +1151,22 @@
 (user);%0A
+    %09%0A
         
@@ -1192,10 +1192,181 @@
 ;%0A    %7D%0A
+%09%0A%09@GetMapping(%22/user/details%22)%0A    public String currentUserDetails(Model model) %7B%0A%09%09model.addAttribute(userService.getCurrentUser());%0A%09%09%0A        return %22details%22;%0A    %7D%0A
 %7D%0A

add routing for details