Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 230de2f

Browse files
committed
password matching validation when signing in
1 parent f1dd4b0 commit 230de2f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/main/java/com/zenfulcode/commercify/commercify/service/AuthenticationService.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ public UserDTO authenticate(LoginUserRequest login) {
8888
)
8989
);
9090

91-
return userRepository.findByEmail(login.email())
92-
.map(mapper)
93-
.orElseThrow();
91+
UserEntity user = userRepository.findByEmail(login.email()).orElseThrow();
92+
93+
if (passwordEncoder.matches(login.password(), user.getPassword()))
94+
return null;
95+
96+
return mapper.apply(user);
9497
}
9598

9699
@Transactional(readOnly = true)

0 commit comments

Comments
 (0)