Created
March 9, 2020 13:00
-
-
Save netstart/9ffa5b2bee1368adf2f2ec8889131885 to your computer and use it in GitHub Desktop.
Revisions
-
netstart created this gist
Mar 9, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ 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; } }