Skip to content

Commit 7a590c2

Browse files
authored
Enable password reset for active users only (#52)
1 parent afc5506 commit 7a590c2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/src/main/java/life/qbic/identityaccess/application/user/UserRegistrationService.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,13 @@ public ApplicationResponse requestPasswordReset(String userEmailAddress) {
166166
return ApplicationResponse.failureResponse(new UserNotFoundException());
167167
}
168168

169-
// trigger password reset
169+
// get user
170170
var user = optionalUser.get();
171+
172+
// We only allow password reset for users with confirmed email address
173+
if (!user.isActive()) {
174+
return ApplicationResponse.failureResponse(new ServiceException("User not active"));
175+
}
171176
DomainEventPublisher.instance().subscribe(new DomainEventSubscriber<PasswordReset>() {
172177
@Override
173178
public Class<? extends DomainEvent> subscribedToEventType() {

0 commit comments

Comments
 (0)