|
@@ -70,44 +70,39 @@ public class SysLoginController extends AbstractController {
|
|
|
public String login(Model model) throws OpenAPIException, ApiException {
|
|
|
String username = getParam("username").trim();
|
|
|
String password = getParam("password").trim();
|
|
|
- Map<String,String>map=new HashMap<>();
|
|
|
- SaleOrderService service=new SaleOrderService();
|
|
|
- service.getToaccount();
|
|
|
- service.IKSDDKOrder();
|
|
|
- //saleOrderController.SaleOrderBJ();
|
|
|
-// try {
|
|
|
-// // 开启验证码
|
|
|
-// if (globalProperties.isKaptchaEnable()) {
|
|
|
-// String code = getParam("code").trim();
|
|
|
-// if (StringUtils.isBlank(code)) {
|
|
|
-// model.addAttribute("errorMsg", "验证码不能为空");
|
|
|
-// return html("/login");
|
|
|
-// }
|
|
|
-// String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
|
|
|
-// if (!code.equalsIgnoreCase(kaptcha)) {
|
|
|
-// model.addAttribute("errorMsg", "验证码错误");
|
|
|
-// return html("/login");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// // 用户名验证
|
|
|
-// if (StringUtils.isBlank(username)) {
|
|
|
-// model.addAttribute("errorMsg", "用户名不能为空");
|
|
|
-// return html("/login");
|
|
|
-// }
|
|
|
-// // 密码验证
|
|
|
-// if (StringUtils.isBlank(password)) {
|
|
|
-// model.addAttribute("errorMsg", "密码不能为空");
|
|
|
-// return html("/login");
|
|
|
-// }
|
|
|
-// UsernamePasswordToken token = new UsernamePasswordToken(username, MD5Utils.encrypt(username, password));
|
|
|
-// ShiroUtils.getSubject().login(token);
|
|
|
-// SecurityUtils.getSubject().getSession().setAttribute("sessionFlag", true);
|
|
|
-// return redirect("/");
|
|
|
-// } catch (UnknownAccountException | IncorrectCredentialsException | LockedAccountException e) {
|
|
|
-// model.addAttribute("errorMsg", e.getMessage());
|
|
|
-// } catch (AuthenticationException e) {
|
|
|
-// model.addAttribute("errorMsg", "登录服务异常");
|
|
|
-// }
|
|
|
+ try {
|
|
|
+ // 开启验证码
|
|
|
+ if (globalProperties.isKaptchaEnable()) {
|
|
|
+ String code = getParam("code").trim();
|
|
|
+ if (StringUtils.isBlank(code)) {
|
|
|
+ model.addAttribute("errorMsg", "验证码不能为空");
|
|
|
+ return html("/login");
|
|
|
+ }
|
|
|
+ String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
|
|
|
+ if (!code.equalsIgnoreCase(kaptcha)) {
|
|
|
+ model.addAttribute("errorMsg", "验证码错误");
|
|
|
+ return html("/login");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 用户名验证
|
|
|
+ if (StringUtils.isBlank(username)) {
|
|
|
+ model.addAttribute("errorMsg", "用户名不能为空");
|
|
|
+ return html("/login");
|
|
|
+ }
|
|
|
+ // 密码验证
|
|
|
+ if (StringUtils.isBlank(password)) {
|
|
|
+ model.addAttribute("errorMsg", "密码不能为空");
|
|
|
+ return html("/login");
|
|
|
+ }
|
|
|
+ UsernamePasswordToken token = new UsernamePasswordToken(username, MD5Utils.encrypt(username, password));
|
|
|
+ ShiroUtils.getSubject().login(token);
|
|
|
+ SecurityUtils.getSubject().getSession().setAttribute("sessionFlag", true);
|
|
|
+ return redirect("/");
|
|
|
+ } catch (UnknownAccountException | IncorrectCredentialsException | LockedAccountException e) {
|
|
|
+ model.addAttribute("errorMsg", e.getMessage());
|
|
|
+ } catch (AuthenticationException e) {
|
|
|
+ model.addAttribute("errorMsg", "登录服务异常");
|
|
|
+ }
|
|
|
return html("/login");
|
|
|
}
|
|
|
|