Redirect to intern if employee.
This commit is contained in:
parent
714ac4f1de
commit
cdc372d574
|
@ -1,11 +1,5 @@
|
|||
package org.hso.ecommerce.controller;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.hso.ecommerce.entities.user.User;
|
||||
import org.hso.ecommerce.repos.user.UserRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -15,6 +9,11 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.Optional;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/")
|
||||
public class LoginController {
|
||||
|
@ -56,6 +55,8 @@ public class LoginController {
|
|||
|
||||
if (gto != null && gto.startsWith("/")) {
|
||||
return "redirect:" + gto;
|
||||
} else if (user.get().isEmployee) {
|
||||
return "redirect:/intern/";
|
||||
} else {
|
||||
return "redirect:/";
|
||||
}
|
||||
|
|
Reference in New Issue