mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Fix for possible NPE.
This commit is contained in:
parent
08aeefa099
commit
d03c677a7f
1 changed files with 7 additions and 8 deletions
|
@ -578,15 +578,14 @@ public class ResponseHelper {
|
|||
|
||||
User dbuser = s.createQuery(cr).uniqueResult();
|
||||
|
||||
String hash = dbuser.getPassword();
|
||||
|
||||
if (dbuser != null) {
|
||||
if (hash.startsWith("$argon2") && argon2PasswordEncoder.matches(pass, hash)) {
|
||||
s.close();
|
||||
return Constants.mapper.writeValueAsBytes(new LoginResponse(dbuser.getSessionId()));
|
||||
}
|
||||
|
||||
if (bcryptPasswordEncoder.matches(pass, hash)) {
|
||||
String hash = dbuser.getPassword();
|
||||
if (hash.startsWith("$argon2")) {
|
||||
if (argon2PasswordEncoder.matches(pass, hash)) {
|
||||
s.close();
|
||||
return Constants.mapper.writeValueAsBytes(new LoginResponse(dbuser.getSessionId()));
|
||||
}
|
||||
} else if (bcryptPasswordEncoder.matches(pass, hash)) {
|
||||
s.close();
|
||||
return Constants.mapper.writeValueAsBytes(new LoginResponse(dbuser.getSessionId()));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue