private void Btn_Register_Click(object sender, RoutedEventArgs e) { BoxPassword.Text = BoxPassword.Text.Trim(); BoxUser_Name.Text = BoxUser_Name.Text.Trim(); if (BoxUser_Name.Text.Contains(' ') || BoxPassword.Text.Contains(' ')) { MessageBox.Show("Fields cannot contain any spaces"); } else { StoreUserCredentials newUser = new StoreUserCredentials(BoxUser_Name.Text, BoxPassword.Text); BoxPassword.Clear(); BoxUser_Name.Clear(); } }
public bool isLogin(string username, string password) { StoreUserCredentials checkAccount = new StoreUserCredentials(username, password, true); using (StreamReader stream = new StreamReader(_CheckPath)) { string fileContent = stream.ReadToEnd(); stream.Close(); if (fileContent.Contains(checkAccount.Hash)) { MessageBox.Show("Login Successful"); UserProperties.Hash = checkAccount.Hash; UserProperties.UserStorageFilePath = this._CheckPath; UserProperties.Key = EncryptDecrypt.CreateKey(UserProperties.Hash); return(true); } return(false); } }