such as the title, with spring MVC 4.3.2+mybatis 3.4.1 + mysql 5.7.14 +shiro developed a management system for kindergartens.
Function module includes account, role, and rights management. Child file management, child charge management and so on. Permission to use the Shiro permission control, feeling is pretty strong. My idea is simple, good enough.
The front-end framework is developed based on the h-ui.admin template. This template is very convenient to use, suitable for the front end is not very familiar with the use of people can achieve professional results. Praise one.
Cut a picture first.
Implementation of the main point, the front-end with JS password with MD5 encrypted and passed to the backstage. Prevent password plaintext transmission.
Background controller implementation of key points, using Shiro password authentication.
@RequestMapping (value= "/login", method=requestmethod.post) public String login (@ModelAttribute logindto login, HttpServletRequest Request,model Model, Bindingresult bindingresult, redirectattributes RedirectAttributes) { try {logger.info ("login is:" +json.tojsonstring (login)); String code = (string) request.getsession (). getattribute ("code"); if (code! = null &&!code.equalsignorecase (Login.getcode ())) {Model.addattribute ("error", "wrong Captcha"); Model.addattribute ("Logindto", login); return "/login"; } if (Bindingresult.haserrors ()) {return "/login"; }//Use the Permissions tool for user login, log in successfully after the jump to Shiro configuration Successurl, and the following return does not matter! Usernamepasswordtoken token = new Usernamepasswordtoken (Login.getusername (), Login.getpassword ()); if (login.getrememberme () = = null) {Login.setrememberme (false); } Token.setrememberme (Login.getrememberme ()); Securityutils.getsubject (). Login (token); return "redirect:/"; } catch (Authenticationexception e) {//redirectattributes.addflashattribute ("message", "User name or password error"); Model.addattribute ("Error", "Wrong user name or password"); Model.addattribute ("Logindto", login); return "/login"; }
Spring MVC 4.3.2 + mybatis 3.4.1 + mysql 5.7.14 +shiro Kindergarten fee System Login