Exemple #1
0
 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));
     }
 }
Exemple #2
0
        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());
        }
Exemple #3
0
        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);
            }
        }
Exemple #4
0
 public LoginInfo getLoginInfo()
 {
     return(new LoginInfo(usernameTxt.Text, SecurePasswordHasher.RepeatableHashForTransfer(passwordTxt.Text, usernameTxt.Text), automaticLoginChb.Checked));
 }