Skip to content

Commit c27893e

Browse files
committed
Merge develop into main
2 parents 2838a70 + 0aee271 commit c27893e

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

‎wise-api/src/main/java/com/wisemapping/rest/UserController.java‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828
import com.wisemapping.rest.model.RestPasswordResetRequest;
2929
import com.wisemapping.rest.model.RestResetPasswordResponse;
3030
import com.wisemapping.rest.model.RestUserRegistration;
31-
import com.wisemapping.service.*;
31+
import com.wisemapping.service.DisposableEmailService;
32+
import com.wisemapping.service.InvalidUserEmailException;
33+
import com.wisemapping.service.MetricsService;
34+
import com.wisemapping.service.RecaptchaService;
35+
import com.wisemapping.service.RegistrationException;
36+
import com.wisemapping.service.UserService;
3237
import com.wisemapping.validator.Messages;
3338
import com.wisemapping.validator.UserValidator;
3439
import io.github.resilience4j.ratelimiter.annotation.RateLimiter;
@@ -128,7 +133,7 @@ public void registerUser(@RequestBody RestUserRegistration registration,
128133
@RateLimiter(name = "passwordResetLimiter")
129134
@RequestMapping(method = RequestMethod.PUT, value = "/resetPassword", produces = {"application/json"})
130135
@ResponseStatus(value = HttpStatus.OK)
131-
public RestResetPasswordResponse resetPassword(@RequestParam String email) throws InvalidAuthSchemaException, EmailNotExistsException {
136+
public RestResetPasswordResponse resetPassword(@RequestParam String email) throws EmailNotExistsException {
132137
try {
133138
return userService.resetPassword(email);
134139
} catch (InvalidUserEmailException e) {

‎wise-api/src/main/java/com/wisemapping/service/UserService.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public interface UserService {
4343

4444
void updateUser(Account user);
4545

46-
RestResetPasswordResponse resetPassword(@NotNull String email) throws InvalidUserEmailException, InvalidAuthSchemaException;
46+
RestResetPasswordResponse resetPassword(@NotNull String email) throws InvalidUserEmailException;
4747

4848
void resetPasswordFromToken(@NotNull String rawToken, @NotNull String newPassword) throws InvalidResetTokenException;
4949

‎wise-api/src/main/java/com/wisemapping/service/UserServiceImpl.java‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,15 @@ public void activateAccount(long code)
9090

9191
@Override
9292
public RestResetPasswordResponse resetPassword(@NotNull String email)
93-
throws InvalidUserEmailException, InvalidAuthSchemaException {
93+
throws InvalidUserEmailException {
9494
final Account user = userManager.getUserBy(email);
9595
if (user != null) {
9696
final RestResetPasswordResponse response = new RestResetPasswordResponse();
97-
if (user.getAuthenticationType().equals(AuthenticationType.GOOGLE_OAUTH2)) {
97+
if (user.getAuthenticationType() != AuthenticationType.DATABASE) {
9898
response.setAction(RestResetPasswordAction.OAUTH2_USER);
9999
return response;
100100
}
101101

102-
if (user.getAuthenticationType() != AuthenticationType.DATABASE) {
103-
throw new InvalidAuthSchemaException("Could not change password for " + user.getAuthenticationType().getCode());
104-
}
105-
106102
// Generate a secure token and send a reset link — the password is NOT changed here
107103
sendPasswordResetLink(user);
108104
logger.info("Password reset link sent for user id {}, token expires in 1 hour", user.getId());

0 commit comments

Comments
 (0)