use of com.ngtesting.platform.vo.UserVo in project ngtesting-platform by aaronchen2k.
the class VerAction method get.
@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
Long id = json.getLong("id");
TestVerVo vo = verService.getById(id);
ret.put("data", vo);
ret.put("code", Constant.RespCode.SUCCESS.getCode());
return ret;
}
use of com.ngtesting.platform.vo.UserVo in project ngtesting-platform by aaronchen2k.
the class AccountAction method resetPassword.
@AuthPassport(validate = false)
@RequestMapping(value = "resetPassword", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> resetPassword(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
String verifyCode = json.getString("vcode");
String password = json.getString("password");
TestUser user = accountService.resetPasswordPers(verifyCode, password);
if (user != null) {
UserVo userVo = userService.genVo(user);
request.getSession().setAttribute(Constant.HTTP_SESSION_USER_KEY, userVo);
ret.put("token", user.getToken());
ret.put("code", RespCode.SUCCESS.getCode());
} else {
ret.put("code", RespCode.BIZ_FAIL.getCode());
ret.put("msg", "重置密码失败");
}
return ret;
}
use of com.ngtesting.platform.vo.UserVo in project ngtesting-platform by aaronchen2k.
the class AccountAction method loginWithVcode.
@AuthPassport(validate = false)
@RequestMapping(value = "loginWithVcode", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> loginWithVcode(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
String vcode = json.getString("vcode");
TestUser user = accountService.resetPasswordPers(vcode, null);
if (user != null) {
UserVo userVo = userService.genVo(user);
request.getSession().setAttribute(Constant.HTTP_SESSION_USER_KEY, userVo);
ret.put("profile", userVo);
ret.put("token", user.getToken());
ret.put("code", RespCode.SUCCESS.getCode());
} else {
ret.put("code", RespCode.BIZ_FAIL.getCode());
ret.put("msg", "登录失败");
}
return ret;
}
use of com.ngtesting.platform.vo.UserVo in project ngtesting-platform by aaronchen2k.
the class AccountAction method login.
@AuthPassport(validate = false)
@RequestMapping(value = "login", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> login(HttpServletRequest request, @RequestBody JSONObject json) {
Map<String, Object> ret = new HashMap<String, Object>();
String email = json.getString("email");
String password = json.getString("password");
boolean rememberMe = json.getBoolean("rememberMe") != null ? json.getBoolean("rememberMe") : false;
TestUser user = accountService.loginPers(email, password, rememberMe);
if (user != null) {
UserVo userVo = userService.genVo(user);
request.getSession().setAttribute(Constant.HTTP_SESSION_USER_KEY, userVo);
ret.put("profile", userVo);
ret.put("token", user.getToken());
ret.put("code", RespCode.SUCCESS.getCode());
} else {
ret.put("code", RespCode.BIZ_FAIL.getCode());
ret.put("msg", "登录失败");
}
return ret;
}
use of com.ngtesting.platform.vo.UserVo in project ngtesting-platform by aaronchen2k.
the class UserServiceImpl method genVo.
@Override
public UserVo genVo(TestUser user) {
if (user == null) {
return null;
}
UserVo vo = new UserVo();
BeanUtilEx.copyProperties(vo, user);
return vo;
}
Aggregations