mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-22 22:21:09 +08:00
feat: login logic
This commit is contained in:
@@ -102,6 +102,7 @@ public class SecurityConfig {
|
||||
.requestMatchers(HttpMethod.GET, "/api/tags/**").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/api/config/**").permitAll()
|
||||
.requestMatchers(HttpMethod.POST,"/api/auth/google").permitAll()
|
||||
.requestMatchers(HttpMethod.POST,"/api/auth/reason").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/api/search/**").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/api/users/**").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/api/reaction-types").permitAll()
|
||||
|
||||
@@ -153,7 +153,7 @@ public class AuthController {
|
||||
return ResponseEntity.ok().body(Map.of("valid", true));
|
||||
}
|
||||
|
||||
userService.register(user.getUsername(), user.getEmail(), user.getPassword(), req.getReason(), registerModeService.getRegisterMode());
|
||||
user = userService.updateReason(user.getUsername(), req.getReason());
|
||||
notificationService.createRegisterRequestNotifications(user, req.getReason());
|
||||
return ResponseEntity.ok().body(Map.of("valid", true));
|
||||
}
|
||||
|
||||
@@ -124,6 +124,13 @@ public class UserService {
|
||||
return userRepository.save(user);
|
||||
}
|
||||
|
||||
public User updateReason(String username, String reason) {
|
||||
User user = userRepository.findByUsername(username)
|
||||
.orElseThrow(() -> new com.openisle.exception.NotFoundException("User not found"));
|
||||
user.setRegisterReason(reason);
|
||||
return userRepository.save(user);
|
||||
}
|
||||
|
||||
public User updateProfile(String currentUsername, String newUsername, String introduction) {
|
||||
User user = userRepository.findByUsername(currentUsername)
|
||||
.orElseThrow(() -> new com.openisle.exception.NotFoundException("User not found"));
|
||||
|
||||
Reference in New Issue
Block a user