feat: 登录页面增加用户名验证

This commit is contained in:
fit2cloud-chenyw
2021-04-22 14:53:23 +08:00
parent acf8ecbdeb
commit 89370df958
5 changed files with 39 additions and 5 deletions

View File

@@ -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();

View File

@@ -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;

View File

@@ -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);