use of org.mx.comps.rbac.dal.entity.LoginHistory in project main by JohnPeng739.
the class AccountManageResource method login.
@Path("login")
@POST
public DataVO<LoginHistoryVO> login(@Context Request request, @Context Response response, AuthenticateAccountPasswordVO vo) {
sessionDataStore.setCurrentUserCode(vo.getAccountCode());
String accountCode = vo.getAccountCode(), password = vo.getPassword();
boolean forced = vo.isForcedReplace();
try {
LoginHistory loginHistory = accountManageService.login(accountCode, password, forced);
LoginHistoryVO loginHistoryVO = LoginHistoryVO.transform(loginHistory);
sessionDataStore.removeCurrentUserCode();
return new DataVO<>(loginHistoryVO);
} catch (UserInterfaceException ex) {
return new DataVO<>(ex);
} catch (Exception ex) {
if (logger.isErrorEnabled()) {
logger.error(String.format("User[%s] login fail.", vo.getAccountCode()), ex);
}
return new DataVO<>(new UserInterfaceSystemErrorException(UserInterfaceSystemErrorException.SystemErrors.SYSTEM_OTHER_FAIL));
}
}
Aggregations