use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class UacUserCommonController method checkNewPassword.
/**
* 校验新密码是否与原始密码相同.
*
* @param checkNewPasswordDto 修改密码实体
*
* @return the wrapper
*/
@PostMapping(value = "/checkNewPassword")
@ApiOperation(httpMethod = "POST", value = "校验新密码是否与原始密码相同")
public Wrapper<Boolean> checkNewPassword(@ApiParam(name = "checkNewPasswordDto", value = "校验新密码是否与原始密码相同Dto") @RequestBody CheckNewPasswordDto checkNewPasswordDto) {
logger.info(" 校验新密码是否与原始密码相同 checkNewPasswordDto={}", checkNewPasswordDto);
String loginName = checkNewPasswordDto.getLoginName();
String newPassword = checkNewPasswordDto.getNewPassword();
UacUser uacUser = new UacUser();
uacUser.setLoginName(loginName);
int result = 0;
UacUser user = uacUserService.findByLoginName(loginName);
if (user == null) {
logger.error("找不到用户. loginName={}", loginName);
} else {
uacUser.setLoginPwd(Md5Util.encrypt(newPassword));
result = uacUserService.selectCount(uacUser);
}
return WrapMapper.ok(result < 1);
}
use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class UacUserMainController method getUacUserById.
/**
* 根据用户Id查询用户信息.
*
* @param userId the user id
*
* @return the uac user by id
*/
@PostMapping(value = "/getUacUserById/{userId}")
@ApiOperation(httpMethod = "POST", value = "根据用户Id查询用户信息")
public Wrapper<UacUser> getUacUserById(@ApiParam(name = "userId", value = "用户ID") @PathVariable Long userId) {
logger.info("getUacUserById - 根据用户Id查询用户信息. userId={}", userId);
UacUser uacUser = uacUserService.queryByUserId(userId);
logger.info("getUacUserById - 根据用户Id查询用户信息. [OK] uacUser={}", uacUser);
return WrapMapper.ok(uacUser);
}
use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class UacUserMainController method modifyUserStatusById.
/**
* 根据Id修改用户状态.
*
* @param modifyUserStatusDto the modify user status dto
*
* @return the wrapper
*/
@PostMapping(value = "/modifyUserStatusById")
@LogAnnotation
@ApiOperation(httpMethod = "POST", value = "根据Id修改用户状态")
public Wrapper<Integer> modifyUserStatusById(@ApiParam(name = "modifyUserStatusDto", value = "用户禁用/启用Dto") @RequestBody ModifyUserStatusDto modifyUserStatusDto) {
logger.info(" 根据Id修改用户状态 modifyUserStatusDto={}", modifyUserStatusDto);
LoginAuthDto loginAuthDto = getLoginAuthDto();
UacUser uacUser = new UacUser();
uacUser.setId(modifyUserStatusDto.getUserId());
uacUser.setStatus(modifyUserStatusDto.getStatus());
int result = uacUserService.modifyUserStatusById(uacUser, loginAuthDto);
return handleResult(result);
}
use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class UacUserMainController method user.
/**
* User security user.
*
* @return the security user
*/
@GetMapping("/user")
public SecurityUser user() {
String loginName = SecurityUtils.getCurrentLoginName();
logger.info("{}", loginName);
UacUser user = uacUserService.findByLoginName(loginName);
return user == null ? null : new SecurityUser(user.getId(), user.getLoginName(), user.getLoginPwd(), user.getUserName(), user.getGroupId(), user.getGroupName());
}
use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class SmsServiceImpl method submitResetPwdPhone.
@Override
public String submitResetPwdPhone(String mobile, HttpServletResponse response) {
Preconditions.checkArgument(StringUtils.isNotEmpty(mobile), "手机号码不能为空");
Preconditions.checkArgument(PubUtils.isMobileNumber(mobile), "手机号码格式不正确");
String resetPwdKey = PubUtils.uuid() + UniqueIdGenerator.generateId();
UacUser user = uacUserService.findByMobileNo(mobile);
redisTemplate.opsForValue().set(RedisKeyUtil.getResetPwdTokenKey(resetPwdKey), user, 10, TimeUnit.MINUTES);
CookieUtil.setCookie("PASSCLOUD_PAAS_resetPwdKey", resetPwdKey, 10 * 60, response);
return resetPwdKey;
}
Aggregations