bugfix-企业登录注册
This commit is contained in:
@@ -827,19 +827,33 @@ public class SysLoginService
|
||||
AppUser appUser = appUserService.getPhoneAndUserType(phone, StringUtil.IS_COMPANY_USER);
|
||||
|
||||
if (appUser != null) {
|
||||
// 用户存在,执行登录
|
||||
// 用户存在
|
||||
if (StringUtils.isBlank(appUser.getYtjPassword())) {
|
||||
return AjaxResult.error("账号密码未设置,请联系管理员!");
|
||||
// 密码为空,设置密码并登录
|
||||
AppUser updateParam = new AppUser();
|
||||
updateParam.setUserId(appUser.getUserId());
|
||||
updateParam.setYtjPassword(SiteSecurityUtils.encryptPassword(password));
|
||||
updateParam.setLoginDate(new Date());
|
||||
// 如果传了企业信息,也更新
|
||||
if (StringUtils.isNotBlank(companyCode)) {
|
||||
updateParam.setIdCard(companyCode);
|
||||
}
|
||||
if (StringUtils.isNotBlank(companyName)) {
|
||||
updateParam.setName(companyName);
|
||||
}
|
||||
appUserService.updateAppUser(updateParam);
|
||||
appUser.setYtjPassword(updateParam.getYtjPassword());
|
||||
} else {
|
||||
// 密码已设置,校验密码
|
||||
if (!SiteSecurityUtils.matchesPassword(password, appUser.getYtjPassword())) {
|
||||
return AjaxResult.error("密码错误,请重新输入!");
|
||||
}
|
||||
|
||||
// 更新登录时间
|
||||
AppUser updateParam = new AppUser();
|
||||
updateParam.setUserId(appUser.getUserId());
|
||||
updateParam.setLoginDate(new Date());
|
||||
appUserService.updateAppUser(updateParam);
|
||||
}
|
||||
|
||||
// 生成token并返回
|
||||
String token = loginUserIdApp(appUser);
|
||||
|
||||
Reference in New Issue
Block a user