Skip to content

Commit

Permalink
chore: enusre old password not blank
Browse files Browse the repository at this point in the history
  • Loading branch information
guqing committed Apr 19, 2024
1 parent db3b415 commit 267701d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,16 @@ public Mono<User> createUser(User user, Set<String> roleNames) {

@Override
public Mono<Boolean> confirmPassword(String username, String rawPassword) {

return getUser(username)
.filter(user -> {
if (!StringUtils.hasText(user.getSpec().getPassword())) {
// If the password is not set, return true directly.
return true;
}
if (!StringUtils.hasText(rawPassword)) {
return false;
}
return passwordEncoder.matches(rawPassword, user.getSpec().getPassword());
})
.hasElement();
Expand Down

0 comments on commit 267701d

Please sign in to comment.