Skip to content

Commit

Permalink
add hashing of passwords (jbcrypt)
Browse files Browse the repository at this point in the history
  • Loading branch information
syarhei committed Dec 17, 2017
1 parent 1d7c866 commit 6a4787d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/models/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.mindrot.jbcrypt.BCrypt;

import javax.persistence.*;

Expand Down Expand Up @@ -48,7 +49,8 @@ public void setNickname(String nickname) {
}

public void setPassword(String password) {
this.password = password;
final String KEY = "$2a$10$QGW.2IJbOMiwP2XR9kG1Bu";
this.password = BCrypt.hashpw(password, KEY);
}

public Integer getBalance() {
Expand Down

0 comments on commit 6a4787d

Please sign in to comment.