| | |
| | |
|
| | |
|
| | | /**
|
| | | * 测试登陆
|
| | | * 后端登陆
|
| | | * @param username
|
| | | * @param pwd
|
| | | * @param request
|
| | |
| | | public void adminLoginJP(String callback, String username,String pwd,String code,
|
| | | HttpServletRequest request,PrintWriter out) {
|
| | |
|
| | | System.out.println("username:"+username);
|
| | | System.out.println("pwd:"+pwd);
|
| | |
|
| | | String ocode = request.getSession().getAttribute(Constant.RANDKEY) + "";
|
| | | |
| | | request.getSession().removeAttribute(Constant.RANDKEY);
|
| | | |
| | | if (StringUtil.isNullOrEmpty(code) || !code.equalsIgnoreCase(ocode)) {
|
| | | out.print(JsonUtil.loadFalseResult("验证码错误"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("验证码错误"));
|
| | | return;
|
| | | } else {
|
| | | if (StringUtil.isNullOrEmpty(username)||StringUtil.isNullOrEmpty(pwd)) {
|
| | | out.print(JsonUtil.loadJSONP(callback,JsonUtil.loadFalseResult("用户名或密码为空")));
|
| | | } else {
|
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(username)||StringUtil.isNullOrEmpty(pwd)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户名或密码为空"));
|
| | | } |
| | |
|
| | | AdminUser info = adminUserService.login(username.trim(), pwd.trim());
|
| | | |
| | | if (info == null) {
|
| | | out.print(JsonUtil.loadJSONP(callback,JsonUtil.loadFalseResult("用户名或密码错误")));
|
| | | return;
|
| | | } else {
|
| | | request.getSession().setAttribute(Constant.SESSION_ADMIN, info);
|
| | | String sessionId=request.getSession().getId();
|
| | | System.out.println("login"+sessionId);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("info", info);
|
| | | out.print(JsonUtil.loadJSONP(callback,JsonUtil.loadTrueResult(data)));
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | AdminUser info = adminUserService.login(username.trim(), pwd.trim());
|
| | | if (info == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户名或密码错误"));
|
| | | return;
|
| | | } |
| | | |
| | | // 缓存到session
|
| | | request.getSession().setAttribute(Constant.SESSION_ADMIN, info);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("info", info);
|
| | | JsonUtil.printMode(out, callback,JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | }
|