use of com.ibeiliao.deployment.admin.annotation.authority.AllowAnonymous in project Corgi by kevinYin.
the class WelcomeController method login.
/**
* 登录接口,sso登录时回调
* @param request
* @param response
* @param account
* @param password
* @return
*/
@RequestMapping("/login.do")
@MenuResource("授权登录")
@AllowAnonymous
@ResponseBody
public RestResult login(HttpServletRequest request, HttpServletResponse response, String account, String password) {
ParameterUtil.assertNotBlank(account, "账户不能为空");
ParameterUtil.assertNotBlank(password, "密码不能为空");
AdminAccount adminAccount = adminAccountService.getByAccount(account);
if (adminAccount == null) {
return new RestResult(ApiCode.FAILURE, "账号不存在");
}
if (!Objects.equals(encoder.encode(password), adminAccount.getPassword())) {
return new RestResult(ApiCode.FAILURE, "账号密码不正确");
}
AdminLoginUser loginUser = new AdminLoginUser();
loginUser.setAccountId(adminAccount.getUid());
loginUser.setAppId(AppConstants.APP_ID_DEFAULT);
AdminContext.saveToCookie(response, loginUser);
logger.info("登录成功 | uid: {}", adminAccount.getUid());
return new RestResult(ApiCode.SUCCESS, "");
}
use of com.ibeiliao.deployment.admin.annotation.authority.AllowAnonymous in project Corgi by kevinYin.
the class CompileLogController method getCompileLog.
@RequestMapping("getCompileLog")
@AllowAnonymous
@ResponseBody
public CompileLogVO getCompileLog(int historyId, int offset) {
CompileLogVO logVO = new CompileLogVO();
logVO.setOffset(offset);
String key = RedisLogKey.getModuleCompileKey(historyId);
Long count = redis.llen(key);
// logger.info("编译日志,总数:{}, 当前偏移量:{}", count, offset);
if (offset == count) {
return logVO;
}
if (count > 0) {
List<String> logs = redis.lrange(key, offset, count);
logVO.setLogs(logs);
logVO.setOffset(count.intValue());
return logVO;
}
return logVO;
}
Aggregations