mirror of
https://github.com/dataease/dataease.git
synced 2026-05-20 19:48:18 +08:00
feat: 登录页面增加用户名验证
This commit is contained in:
@@ -7,6 +7,8 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Api(tags = "权限:权限管理")
|
||||
@RequestMapping("/api/auth")
|
||||
@@ -26,6 +28,9 @@ public interface AuthApi {
|
||||
@PostMapping("/logout")
|
||||
String logout();
|
||||
|
||||
@PostMapping("/validateName")
|
||||
Boolean validateName(Map<String, String> nameDto);
|
||||
|
||||
|
||||
@GetMapping("/test")
|
||||
String test();
|
||||
|
||||
@@ -82,6 +82,15 @@ public class AuthServer implements AuthApi {
|
||||
return "success";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean validateName(@RequestBody Map<String, String> nameDto) {
|
||||
String userName = nameDto.get("userName");
|
||||
if (StringUtils.isEmpty(userName)) return false;
|
||||
SysUserEntity userEntity = authUserService.getUserByName(userName);
|
||||
if (ObjectUtils.isEmpty(userEntity)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isLogin() {
|
||||
return null;
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
|
||||
|
||||
filterChainDefinitionMap.put("/api/auth/login", ANON);
|
||||
filterChainDefinitionMap.put("/api/auth/validateName", ANON);
|
||||
filterChainDefinitionMap.put("/unauth", ANON);
|
||||
filterChainDefinitionMap.put("/display/**", ANON);
|
||||
filterChainDefinitionMap.put("/tokenExpired", ANON);
|
||||
|
||||
Reference in New Issue
Block a user