public Boolean CheckCorrectUser(LoginData loginData) { //Check if correct admin if (loginData.username == AdminCredentials.Username && Crypto.VerifyHashedPassword(Crypto.HashPassword(Crypto.SHA256(AdminCredentials.Password)), loginData.password) ) { return(true); } //Check if user was found fv_users finalUser = null; try { finalUser = fv_users.Single(m => m.u_name == loginData.username); } catch (InvalidOperationException) { } if (finalUser == null) { return(false); } //Check if password is right if (Crypto.VerifyHashedPassword(finalUser.u_password, loginData.password)) { //Check if username is not blocked if (finalUser.u_isLocked == 0) { return(true); } } return(false); }
public string GetFirstNameForUsername(string username) { if (UserIsAdmin(username)) { return("Administrator"); } //Check if user was found fv_users finalUser = null; try { finalUser = fv_users.Single(m => m.u_name == username); } catch (InvalidOperationException) { } if (finalUser == null) { return("[undefined]"); } return(finalUser.u_firstName); }