feat:添加访问密码

This commit is contained in:
czhqwer
2025-03-29 18:25:54 +08:00
parent 8bece56908
commit 72c5750f84
5 changed files with 570 additions and 4 deletions
@@ -35,9 +35,14 @@ public class ConfigController {
return Result.success();
}
@PostMapping("/set-password")
public Result<?> setPassword(@RequestBody String password) {
@PostMapping("/setPassword")
public Result<?> setPassword(@RequestParam String password) {
authService.setMainUserPassword(password);
return Result.success();
}
@GetMapping("/getPassword")
public Result<?> getPassword() {
return Result.success(authService.getMainUserPassword());
}
}
@@ -42,7 +42,7 @@ public class AuthServiceImpl implements IAuthService {
user.setCreateTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
}
user.setPassword(password != null && password.trim().isEmpty() ? null : password);
user.setPassword(password != null && password.trim().isEmpty() ? "" : password);
if (user.getId() == null) {
userConfigMapper.insert(user);
} else {