mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-10-23 06:32:32 +00:00
change one's password
This commit is contained in:
1 parent
ae46fa2e6d
commit
30b4e2aa2a
1 file changed
+16
@@ -127,6 +127,22 @@ public class User {
|
||||
init();
|
||||
}
|
||||
|
||||
public boolean changePassword(String oldPass, String pass0, String pass1) {
|
||||
String curPass = _hashedPassword;
|
||||
Hash curPassHash = _context.sha().calculateHash(DataHelper.getUTF8(oldPass));
|
||||
Hash newPassHash = _context.sha().calculateHash(DataHelper.getUTF8(pass0));
|
||||
if (curPassHash.toBase64().equals(curPass)) {
|
||||
if ( (pass0 != null) && (pass1 != null) && (pass0.equals(pass1)) ) {
|
||||
_hashedPassword = newPassHash.toBase64();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String login(String login, String pass, Properties props) {
|
||||
_username = login;
|
||||
load(props);
|
||||
|
||||
Reference in new issue
Block a user