@Override public IAccountType getUserType() { return original.getUserType(); }
@Override public void updatePassword(String userId, String oldPassword, String newPassword) throws ServiceException { String msg = "Failed to update password. "; if (VerifyTools.isBlank(userId)) { log.error(msg + "params is null: userId"); throw new ServiceException(ResultCode.PARAMETER_IS_REQUIRED); } if (VerifyTools.isBlank(oldPassword)) { log.error(msg + "params is null: oldPassword"); throw new ServiceException(ResultCode.PARAMETER_IS_REQUIRED); } if (VerifyTools.isBlank(newPassword)) { log.error(msg + "params is null: newPassword"); throw new ServiceException(ResultCode.PARAMETER_IS_REQUIRED); } UserCoreBean user = userCoreBasic.findById(userId); if (user == null) { log.error(msg + "user info not found. id:{}", userId); throw new ServiceException(UserErrorCode.USER_NOT_EXIST); } // 验证旧密码是否正确 if (!passwordService.validate(userId, oldPassword, user.getPassword())) { log.error(msg + "old password error. id:{}", userId); throw new ServiceException(UserErrorCode.OLD_PASSWORD_ERROR); } doUpdatePassword(user.getTenantCode(), user.getUserType(), userId, newPassword); }
AccountBean bean = new AccountBean(user.getTenantCode(), user.getUserType(), newPhone); userCoreExecutor.checkPhoneThrowOnAlreadyExists(bean, userId);
UserCoreBean u = null; for (UserCoreBean bean : all) { if (bean.getUserType() == tp) { u = bean; break;
/** 发送找回密码短信/邮件验证码, account=手机号码/邮箱地址 **/ @ResponseBody @RequestMapping("repassword/send-valid-code") // @RequiresPermissions("personnel:mine:repassword") @OperateRecord("找回密码:发送验证码") public ResponseMessage sendRepasswordValidCode(AccountBean model) { String msg = "Failed to send RepasswordValidCode. "; if (VerifyTools.isBlank(model.getAccount())) { log.error(msg + "params is null: account"); return new ResponseMessage(ResultCode.PARAMETER_IS_REQUIRED); } try { if (VerifyTools.isBlank(model.getType())) { model.setType(defaultValues.getUserType()); } IAccountType[] choose = ConvertTools.toArray(defaultValues.getUserTypeChoose(), IAccountType.class); UserCoreBean user = userAuthExecutor.sendRepasswordValidCode(model, choose); model.setType(user.getUserType()); // 账号类型已明确 SessionTools.setAttribute(REPASSWORD_VALIDATED_ACCOUNT, model); return new ResponseMessage(); } catch (ServiceException e) { return new ResponseMessage(e); } }
AccountBean bean = new AccountBean(user.getTenantCode(), user.getUserType(), newPhone); userCoreExecutor.checkPhoneThrowOnAlreadyExists(bean, userId);
/** 发送登录短信/邮件验证码, account=手机号码/邮箱地址 **/ @ResponseBody @RequestMapping("login/send-valid-code") @OperateRecord("登录:发送验证码") public ResponseMessage sendLoginValidCode(AccountBean model) { // 发送登录短信/邮件验证码 // 只有先找到用户, 才能发短信, 因此发送完短信就确定了用户 // 此时将用户信息缓存在SESSION中 // 之后只需要在提交短信/邮件验证码时, 验证一下短信是否正确即可 try { String account = model.getAccount(); if (VerifyTools.isBlank(account)) { return new ResponseMessage(ResultCode.PARAMETER_IS_REQUIRED); } if (VerifyTools.isBlank(model.getType())) { model.setType(defaultValues.getUserType()); } IAccountType[] choose = ConvertTools.toArray(defaultValues.getUserTypeChoose(), IAccountType.class); UserCoreBean user = userAuthExecutor.sendLoginValidCode(model, choose); model.setType(user.getUserType()); // 账号类型已明确 SessionTools.setAttribute(LOGIN_VALIDATED_ACCOUNT, model); SessionTools.setAttribute(LOGIN_VALIDATED_USER, user); return new ResponseMessage(); } catch (ServiceException e) { return new ResponseMessage(e); } }
IAccountType userType = model.getUserType(); String password = model.getPassword(); if (VerifyTools.isBlank(password)) {
IAccountType userType = older.getUserType(); UserCoreUpdate newer = createChangedModel(model, older);
if (VerifyTools.isBlank(list)) { list = resourceCoreQueryer.listByUserType(user.getUserType(), sceneType, true);
IAccountType userType = model.getUserType();