mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、bug#565 登录校验优化;2、发送短信只在修改手机时校验用户登录;
This commit is contained in:
+2
-1
@@ -42,6 +42,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
@@ -106,7 +107,7 @@ public class ReportTemplateController {
|
||||
@GetMapping("/templates")
|
||||
@Operation(summary = "获取报表模板信息列表")
|
||||
@PreAuthorize("@ss.hasPermission('report:design')")
|
||||
public CommonResult<List<ReportTemplateRespVO>> getTemplatePage(@RequestParam(value = "name", required = false) String name) {
|
||||
public CommonResult<List<ReportTemplateRespVO>> getTemplatePage(@RequestParam(value = "name", required = false) @Size(max = 64, message = "模板名称长度不能超过64个字符") String name) {
|
||||
ReportTemplateReqVO reqVO = new ReportTemplateReqVO(name, null);
|
||||
return success(BeanUtils.toBean(templateService.getReportTemplateList(reqVO), ReportTemplateRespVO.class));
|
||||
}
|
||||
|
||||
+4
@@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -33,11 +34,14 @@ public class ReportTemplateSaveReqVO {
|
||||
private String content;
|
||||
|
||||
@Schema(description = "备注", example = "该模板仅供生产使用")
|
||||
@Length(max = 64, message = "备注长度不能超过64个字符")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "数据源id列表")
|
||||
@Size(max = 20, message = "数据源数量不能超过20个")
|
||||
private Set<Long> datasourceIds;
|
||||
|
||||
@Schema(description = "数据集id列表")
|
||||
@Size(max = 20, message = "数据集数量不能超过20个")
|
||||
private Set<Long> datasetIds;
|
||||
}
|
||||
|
||||
+1
-2
@@ -105,8 +105,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
||||
// 校验机构有效性
|
||||
organService.validOrgan(user.getOrganId());
|
||||
// 校验密码
|
||||
String userPassword = user.getPassword();
|
||||
if (StringUtils.isNotEmpty(userPassword) && !userService.isPasswordMatch(password, userPassword)) {
|
||||
if (!userService.isPasswordMatch(password, user.getPassword())) {
|
||||
createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
||||
throw ServiceExceptionUtil.exception(ErrorCodeConstants.AUTH_LOGIN_BAD_CREDENTIALS);
|
||||
}
|
||||
|
||||
+3
-3
@@ -60,9 +60,6 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
public void sendSmsCode(SmsCodeSendReqDTO reqDTO) {
|
||||
AdminUserDO user = userService.getUserByUsernameAndOrganId(reqDTO.getMobile(), null);
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new ServiceException(GlobalErrorCodeConstants.UNAUTHORIZED);
|
||||
}
|
||||
// 更新手机号场景检查
|
||||
if (ObjectUtil.equal(SmsSceneEnum.USER_UPDATE_MOBILE.getScene(), reqDTO.getScene())) {
|
||||
userUpdateMobileValid(user, loginUser);
|
||||
@@ -89,6 +86,9 @@ public class SmsCodeServiceImpl implements SmsCodeService {
|
||||
* @param loginUser
|
||||
*/
|
||||
private void userUpdateMobileValid(AdminUserDO user, LoginUser loginUser) {
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new ServiceException(GlobalErrorCodeConstants.UNAUTHORIZED);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(user)) {
|
||||
if (ObjectUtil.equal(user.getId(), loginUser.getId())) {
|
||||
// 手机号没有改变无需验证码
|
||||
|
||||
Reference in New Issue
Block a user