mirror of https://gitee.com/topiam/eiam
fix: 登录提示、日志&组织缓存&门户端应用列表
* fix: 登录提示、日志&组织缓存&门户端应用列表 * fix: 更新身份源配置&保存存储配置pull/37/head
parent
ab528c08db
commit
7798acece0
|
@ -74,32 +74,31 @@ public class SendSmsOtpFilter extends OncePerRequestFilter {
|
|||
if (StringUtils.isBlank(recipient)) {
|
||||
throw new PhoneNotExistException();
|
||||
}
|
||||
boolean isSend = sendOtp(recipient);
|
||||
//发送OTP
|
||||
if (isSend) {
|
||||
HttpResponseUtils.flushResponseJson(response, HttpStatus.OK.value(),
|
||||
ApiRestResult.ok());
|
||||
return;
|
||||
}
|
||||
HttpResponseUtils.flushResponseJson(response, HttpStatus.OK.value(),
|
||||
ApiRestResult.err().message("请输入正确的手机号"));
|
||||
sendOtp(response, recipient);
|
||||
}
|
||||
|
||||
public RequestMatcher getRequestMatcher() {
|
||||
return SMS_SEND_OPT_MATCHER;
|
||||
}
|
||||
|
||||
public boolean sendOtp(String recipient) {
|
||||
public void sendOtp(HttpServletResponse response, String recipient) {
|
||||
if (isPhoneValidate(recipient)) {
|
||||
//判断是否存在用户
|
||||
UserEntity user = userRepository
|
||||
.findByPhone(PhoneNumberUtils.getPhoneNumber(recipient));
|
||||
if (!Objects.isNull(user)) {
|
||||
if (Objects.nonNull(user)) {
|
||||
otpContextHelp.sendOtp(recipient, SmsType.LOGIN.getCode(), SMS);
|
||||
return true;
|
||||
HttpResponseUtils.flushResponseJson(response, HttpStatus.OK.value(),
|
||||
ApiRestResult.ok());
|
||||
} else {
|
||||
logger.warn("发送验证码登录失败, 手机号不存在: [{" + recipient + "}]");
|
||||
HttpResponseUtils.flushResponseJson(response, HttpStatus.OK.value(),
|
||||
ApiRestResult.ok());
|
||||
}
|
||||
} else {
|
||||
HttpResponseUtils.flushResponseJson(response, HttpStatus.OK.value(),
|
||||
ApiRestResult.err().message("请输入正确的手机号"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final UserRepository userRepository;
|
||||
|
|
|
@ -278,4 +278,13 @@ public interface OrganizationRepository extends LogicDeleteRepository<Organizati
|
|||
@Override
|
||||
@CacheEvict(allEntries = true)
|
||||
<S extends OrganizationEntity> S save(@NotNull S entity);
|
||||
|
||||
/**
|
||||
* delete all by id
|
||||
*
|
||||
* @param ids {@link Iterable}
|
||||
*/
|
||||
@CacheEvict(allEntries = true)
|
||||
@Override
|
||||
void deleteAllById(@NotNull Iterable<? extends String> ids);
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ public class OrganizationRepositoryCustomizedImpl implements OrganizationReposit
|
|||
* @param list {@link List}
|
||||
*/
|
||||
@Override
|
||||
@CacheEvict(allEntries = true)
|
||||
public void batchSave(List<OrganizationEntity> list) {
|
||||
jdbcTemplate.batchUpdate(
|
||||
"INSERT INTO organization (id_, code_, name_, parent_id, is_leaf, external_id, data_origin, type_, is_enabled, order_, path_, display_path, identity_source_id,create_by,create_time,update_by,update_time,remark_,is_deleted) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
|
|
|
@ -82,18 +82,12 @@ public class AppRepositoryCustomizedImpl implements AppRepositoryCustomized {
|
|||
WHERE
|
||||
app.is_enabled = 1
|
||||
AND app.is_deleted = '0'
|
||||
AND app_acce.subject_id IN (:subjectIds)
|
||||
AND (app_acce.subject_id IN (:subjectIds) OR app.authorization_type = 'all_access')
|
||||
""");
|
||||
//用户名
|
||||
if (StringUtils.isNoneBlank(name)) {
|
||||
builder.append(" AND app.name_ like '%").append(name).append("%'");
|
||||
}
|
||||
//或者是全员可访问的应用
|
||||
builder.append(" OR app.authorization_type = '").append("all_access'");
|
||||
//用户名
|
||||
if (StringUtils.isNoneBlank(name)) {
|
||||
builder.append(" AND app.name_ like '%").append(name).append("%'");
|
||||
}
|
||||
//@formatter:on
|
||||
String sql = builder.toString();
|
||||
List<AppEntity> list = namedParameterJdbcTemplate.query(
|
||||
|
|
|
@ -293,11 +293,15 @@ public interface UserConverter {
|
|||
.of(s -> s.field(FieldSort.of(f -> f.field(EVENT_TIME).order(sortOrder))));
|
||||
fieldSortBuilders.add(eventTimeSortBuilder);
|
||||
});
|
||||
return new NativeQueryBuilder().withQuery(queryBuilder.build()._toQuery())
|
||||
NativeQueryBuilder nativeQueryBuilder = new NativeQueryBuilder()
|
||||
.withQuery(queryBuilder.build()._toQuery())
|
||||
//分页参数
|
||||
.withPageable(PageRequest.of(page.getCurrent(), page.getPageSize()))
|
||||
.withPageable(PageRequest.of(page.getCurrent(), page.getPageSize()));
|
||||
if (!CollectionUtils.isEmpty(fieldSortBuilders)) {
|
||||
//排序
|
||||
.withSort(fieldSortBuilders).build();
|
||||
nativeQueryBuilder.withSort(fieldSortBuilders);
|
||||
}
|
||||
return nativeQueryBuilder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue