Search in sources :

Example 6 with UacUser

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);
}
Also used : UacUser(com.paascloud.provider.model.domain.UacUser) ApiOperation(io.swagger.annotations.ApiOperation)

Example 7 with UacUser

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);
}
Also used : UacUser(com.paascloud.provider.model.domain.UacUser) ApiOperation(io.swagger.annotations.ApiOperation)

Example 8 with 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);
}
Also used : UacUser(com.paascloud.provider.model.domain.UacUser) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 9 with UacUser

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());
}
Also used : UacUser(com.paascloud.provider.model.domain.UacUser) SecurityUser(com.paascloud.security.core.SecurityUser)

Example 10 with UacUser

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;
}
Also used : UacUser(com.paascloud.provider.model.domain.UacUser)

Aggregations

UacUser (com.paascloud.provider.model.domain.UacUser)17 ApiOperation (io.swagger.annotations.ApiOperation)8 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)4 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)3 UserTokenDto (com.paascloud.base.dto.UserTokenDto)2 MenuVo (com.paascloud.provider.model.vo.MenuVo)2 SecurityUser (com.paascloud.security.core.SecurityUser)2 ModelMapper (org.modelmapper.ModelMapper)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 JSONObject (com.alibaba.fastjson.JSONObject)1 HttpConfig (com.arronlong.httpclientutil.common.HttpConfig)1 HttpHeader (com.arronlong.httpclientutil.common.HttpHeader)1 PageInfo (com.github.pagehelper.PageInfo)1 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 MqMessageData (com.paascloud.provider.model.domain.MqMessageData)1 UacGroup (com.paascloud.provider.model.domain.UacGroup)1 UacGroupUser (com.paascloud.provider.model.domain.UacGroupUser)1 UacRole (com.paascloud.provider.model.domain.UacRole)1 UacUserToken (com.paascloud.provider.model.domain.UacUserToken)1 LoginRespDto (com.paascloud.provider.model.dto.user.LoginRespDto)1