mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-22 22:21:09 +08:00
Merge branch 'main' into codex/remove-duplicate-notifications-for-register-request
This commit is contained in:
@@ -93,9 +93,14 @@ public class AuthController {
|
||||
Optional<User> user = googleAuthService.authenticate(req.getIdToken(), req.getReason(), registerModeService.getRegisterMode());
|
||||
if (user.isPresent()) {
|
||||
if (!user.get().isApproved()) {
|
||||
if (req.getReason() != null && !req.getReason().isEmpty()) {
|
||||
// do not send empty notification (while try login)
|
||||
if (user.get().getRegisterReason() != null && !user.get().getRegisterReason().isEmpty()) {
|
||||
// do not send empty notifition (while try login)
|
||||
notificationService.createRegisterRequestNotifications(user.get(), req.getReason());
|
||||
|
||||
return ResponseEntity.badRequest().body(Map.of(
|
||||
"error", "Account awaiting approval",
|
||||
"reason_code", "IS_APPROVING"
|
||||
));
|
||||
}
|
||||
return ResponseEntity.badRequest().body(Map.of(
|
||||
"error", "Account awaiting approval",
|
||||
|
||||
@@ -50,6 +50,12 @@ public class GoogleAuthService {
|
||||
user.setVerificationCode(null);
|
||||
userRepository.save(user);
|
||||
}
|
||||
|
||||
if (!user.isApproved() && reason != null && !reason.isEmpty()) {
|
||||
user.setRegisterReason(reason);
|
||||
userRepository.save(user);
|
||||
}
|
||||
|
||||
return user;
|
||||
}
|
||||
User user = new User();
|
||||
|
||||
Reference in New Issue
Block a user