| | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.google.code.kaptcha.Constants; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.beetl.ShiroExtUtil; |
| | | import com.stylefeng.guns.core.common.constant.Const; |
| | | import com.stylefeng.guns.core.common.exception.InvalidKaptchaException; |
| | | import com.stylefeng.guns.core.log.LogManager; |
| | |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.stylefeng.guns.core.support.HttpKit.getIp; |
| | |
| | | @Autowired |
| | | private IRelationService relationService; |
| | | |
| | | @Autowired |
| | | private ShiroExtUtil shiroExtUtil; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到主页 |
| | | */ |
| | | @RequestMapping(value = "/", method = RequestMethod.GET) |
| | | @RequestMapping(value = "/login", method = RequestMethod.GET) |
| | | public String index(Model model, HttpServletRequest request) throws UnsupportedEncodingException { |
| | | //session中解析用户数据 |
| | | HttpSession session = request.getSession(); |
| | |
| | | List<MenuNode> titles = MenuNode.buildTitle(menus); |
| | | titles = ApiMenuFilter.build(titles); |
| | | shiroUser.setMenuIds(menuList.stream().map(Menu::getUrl).collect(Collectors.toList())); |
| | | shiroUser.setRoleType(user.getRoleType()); |
| | | shiroUser.setObjectId(user.getObjectId()); |
| | | |
| | | model.addAttribute("titles", titles); |
| | | |
| | |
| | | null == user.getPassWordUpdate() |
| | | || user.getPassWordUpdate().getTime() + 7776000000L <= System.currentTimeMillis() |
| | | ? "您的密码已经90天未更换了,请及时更换密码!!!" : ""); |
| | | redisUtil.setStrValue(loginUser.getOnconUUID(), JSON.toJSONString(shiroUser), 36000); |
| | | return "/index.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到登录页面 |
| | | */ |
| | | @RequestMapping(value = "/login", method = RequestMethod.GET) |
| | | public String login(Model model) { |
| | | model.addAttribute("number",0); |
| | | if (ShiroKit.isAuthenticated() || shiroExtUtil.getUser() != null) { |
| | | return REDIRECT + "/"; |
| | | } else { |
| | | return "/login.html"; |
| | | } |
| | | } |
| | | // /** |
| | | // * 跳转到登录页面 |
| | | // */ |
| | | // @RequestMapping(value = "/login", method = RequestMethod.GET) |
| | | // public String login(Model model) { |
| | | // model.addAttribute("number",0); |
| | | // if (shiroExtUtil.authenticated() || shiroExtUtil.getUser() != null) { |
| | | // return REDIRECT + "/"; |
| | | // } else { |
| | | // return "/login.html"; |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 点击登录执行的动作 |