Created
March 9, 2020 13:00
-
-
Save netstart/9ffa5b2bee1368adf2f2ec8889131885 to your computer and use it in GitHub Desktop.
Password.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | |
public class Password { | |
public User changePassword(String newClearPassword) { | |
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); | |
if (!passwordEncoder.matches(newClearPassword, this.getPassword())) { | |
throw new InvalidPasswordException(); | |
} | |
this.password(passwordEncoder, newClearPassword); | |
return this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment