public LoginAccount getLoginAccount() { if (_loginSession == null) { return(new LoginAccount(usernameTxt.Text, SecurePasswordHasher.RepeatableHashForTransfer(passwordTxt.Text, usernameTxt.Text), playernameTxt.Text)); } else { return(new LoginAccount(_loginSession.Username, SecurePasswordHasher.RepeatableHashForTransfer(passwordTxt.Text, _loginSession.Username), playernameTxt.Text)); } }
private static string handleUpdateLoginRequest(NameValueCollection requestData) { var responseData = HttpUtility.ParseQueryString(""); if (LoginAccountList.TryUpdateLogin(requestData["username"], SecurePasswordHasher.Hash(requestData["newpassword"]), requestData["newplayername"], requestData["oldpassword"], requestData["oldplayername"])) { responseData.Add("result", "success"); } else { responseData.Add("result", "fail"); } return(responseData.ToString()); }
public static bool TryUpdateLogin(string Username, string newPassword, string newPlayername, string oldPassword, string oldPlayername) { LoginAccount updateableLoginAccount = new LoginAccount(Username, newPassword, newPlayername); //TryUpdate gör inte djup jämförelse (går troligtvis att lägga till stöd för compare i LoginAccount) LoginAccount oldLoginAccount; if (_loginAccountList.TryGetValue(Username, out oldLoginAccount) && SecurePasswordHasher.Verify(oldPassword, oldLoginAccount.Password) && oldLoginAccount.Playername == oldPlayername) { return(_loginAccountList.TryUpdate(Username, updateableLoginAccount, oldLoginAccount)); } else { return(false); } }
public LoginInfo getLoginInfo() { return(new LoginInfo(usernameTxt.Text, SecurePasswordHasher.RepeatableHashForTransfer(passwordTxt.Text, usernameTxt.Text), automaticLoginChb.Checked)); }