@@ -0,0 +1,2494 @@
+package io.github.javageeks.mase.web;%0A%0Aimport io.github.javageeks.mase.model.User;%0Aimport io.github.javageeks.mase.service.UserService;%0Aimport io.github.javageeks.mase.web.util.SessionData;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Controller;%0Aimport org.springframework.web.bind.annotation.*;%0A%0Aimport javax.servlet.http.HttpSession;%0A%0A/**%0A * User web controller.%0A */%0A@Controller%0Apublic class UserController %7B%0A%0A    @Autowired%0A    private UserService userService;%0A%0A    @Autowired%0A    private SessionData sessionData;%0A%0A    /*%0A    **********************%0A    * Create account%0A    **********************%0A    */%0A%0A    @RequestMapping(value = %22/account%22 , method = RequestMethod.POST)%0A    public @ResponseBody%0A    User registerNewAccount(@RequestBody User user) %7B%0A%0A        if (userService.findByEmail(user.getEmail()) != null) %7B%0A            //user exists, TODO : return error status code%0A            return null;%0A        %7D%0A%0A        user = userService.saveOrUpdate(user);%0A        sessionData.setUser(user);%0A%0A        return user;%0A    %7D%0A%0A    /*%0A    **********************%0A    * Update account%0A    **********************%0A    */%0A%0A    @RequestMapping(value = %22/account%22, method = RequestMethod.PUT)%0A    public @ResponseBody%0A    User updateAccount(@RequestBody User user) %7B%0A%0A        user = userService.saveOrUpdate(user);%0A        sessionData.setUser(user);%0A%0A        return user;%0A%0A    %7D%0A%0A    /*%0A    **********************%0A    * Account details%0A    **********************%0A    */%0A%0A    @RequestMapping(value = %22/account%22, method = RequestMethod.GET)%0A    public @ResponseBody%0A    User showAccountDetails() %7B%0A        return sessionData.getUser();%0A    %7D%0A%0A    /*%0A    **********************%0A    * Delete Account%0A    **********************%0A    */%0A%0A    @RequestMapping(value = %22/account%22, method = RequestMethod.DELETE)%0A    public void deleteAccount(HttpSession session) %7B%0A        userService.delete(sessionData.getUser());%0A        sessionData.setUser(null);%0A        session.invalidate();%0A    %7D%0A%0A    /*%0A    **********************%0A    * Login user%0A    **********************%0A    */%0A%0A    @RequestMapping(value = %22/login%22, method = RequestMethod.POST)%0A    public void login(@RequestParam String email, @RequestParam  String password) %7B%0A        User user = userService.findByEmailAndPassword(email, password);%0A        if (user == null) %7B%0A            //no user found, TODO : return status code%0A            return;%0A        %7D%0A        sessionData.setUser(user);%0A    %7D%0A%0A%7D

add user web controller