文件名从 src/main/java/com/lf/server/controller/SignController.java 修改 |
| | |
| | | package com.lf.server.controller; |
| | | package com.lf.server.controller.sys; |
| | | |
| | | import com.lf.server.entity.LoginInfo; |
| | | import com.lf.server.entity.Result; |
| | | import com.lf.server.entity.User; |
| | | import com.lf.server.service.UserService; |
| | | import com.lf.server.entity.sys.LoginInfo; |
| | | import com.lf.server.entity.sys.Result; |
| | | import com.lf.server.entity.sys.User; |
| | | import com.lf.server.service.sys.UserService; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.apache.shiro.authc.*; |
| | | import org.apache.shiro.subject.Subject; |
| | |
| | | @Autowired |
| | | UserService userService; |
| | | |
| | | @RequestMapping("/getName") |
| | | @GetMapping("/getName") |
| | | public User getName(String loginName) { |
| | | return userService.queryUserByName(loginName); |
| | | } |
| | |
| | | * |
| | | * @return String |
| | | */ |
| | | @RequestMapping({"/", "/toIndex"}) |
| | | @GetMapping({"/", "/toIndex"}) |
| | | public ModelAndView toIndex(ModelAndView mv) { |
| | | mv.setViewName("index"); |
| | | |
| | |
| | | * |
| | | * @return String |
| | | */ |
| | | @RequestMapping("/toLogin") |
| | | @GetMapping("/toLogin") |
| | | public ModelAndView toLogin(ModelAndView mv) { |
| | | mv.setViewName("login"); |
| | | |
| | |
| | | * |
| | | * @return String |
| | | */ |
| | | @RequestMapping("/noauth") |
| | | @GetMapping("/noauth") |
| | | public ModelAndView toNoAuth(ModelAndView mv) { |
| | | mv.setViewName("noauth"); |
| | | |
| | |
| | | * |
| | | * @return String |
| | | */ |
| | | @RequestMapping("/buy") |
| | | @GetMapping("/buy") |
| | | public String buy() { |
| | | Subject subject = SecurityUtils.getSubject(); |
| | | |
| | |
| | | * |
| | | * @return String |
| | | */ |
| | | @RequestMapping("/login") |
| | | @GetMapping("/login") |
| | | public ModelAndView login(String username, String password, String service, Integer rememberMe) { |
| | | ModelAndView mv = new ModelAndView(); |
| | | try { |
| | |
| | | * |
| | | * @return String |
| | | */ |
| | | @RequestMapping("/logout") |
| | | @GetMapping("/logout") |
| | | public ModelAndView logout() { |
| | | Subject subject = SecurityUtils.getSubject(); |
| | | subject.logout(); |
| | |
| | | * @param userInfo |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/ajaxLogin", method = RequestMethod.POST, produces = "application/json; charset=UTF-8") |
| | | @PostMapping(value = "/ajaxLogin", produces = "application/json; charset=UTF-8") |
| | | public Result ajaxLogin(@RequestBody User userInfo) { |
| | | try { |
| | | Subject subject = SecurityUtils.getSubject(); |