Richards_Branch #4

Merged
PBS2H21ASH merged 7 commits from Richards_Branch into main 2023-01-23 08:59:53 +01:00
Showing only changes of commit 27710e92af - Show all commits

View File

@ -106,9 +106,15 @@ public class AccountMgr {
String[] pwH = {"email"}; String[] pwH = {"email"};
String[] pwD = {email}; String[] pwD = {email};
List<String> foundEmail = Database.select("user",pwH,pwD); List<String> foundEmail = Database.select("user",pwH,pwD);
String[] userParts = foundEmail.get(0).split(":"); String salt;
String[] pwParts = userParts[4].split("\\."); if(foundEmail.size() == 1){
String salt = pwParts[1]; String[] userParts = foundEmail.get(0).split(":");
String[] pwParts = userParts[4].split("\\.");
salt = pwParts[1];
}else{
//no unique user found; still calculating a hash for security reasons
salt = getSalt();
}
String[] userH = {"email","password"}; String[] userH = {"email","password"};
String[] userD = {email,hashAndSalt(pw,salt)}; String[] userD = {email,hashAndSalt(pw,salt)};
return Database.getSingleId("user",userH,userD); return Database.getSingleId("user",userH,userD);