private void LoginNewUserPanel_VisibleChanged(object sender, EventArgs e) { if (Visible) { SetStatus(); usernameTextBox.Focus(); usernameTextBox.Text = ""; emailTextBox.Text = ""; passwordTextBox.Text = ""; verifyPasswordTextBox.Text = ""; privateCheckBox.Checked = false; ValidatedUser = null; api = null; if (ParentForm != null) { this.ParentForm.AcceptButton = createAccountOkButton; this.ParentForm.CancelButton = backButton; backButton.DialogResult = DialogResult.None; } } else { if (ParentForm != null) { this.ParentForm.AcceptButton = null; this.ParentForm.CancelButton = null; } } }
private void VerifyLogin() { // set the status label to inform the user of whats happening statusLabel.ForeColor = defaultLabelColor; statusLabel.Text = "Verifying login credentials..."; statusLabel.Visible = true; // disable the log in button so the user doesnt double tap it signInOkButton.Enabled = false; ThreadStart actions = delegate { try { api = FollwitApi.Login(usernameTextBox.Text, FollwitApi.HashPassword(passwordTextBox.Text), ApiUrl); } catch (Exception ex) { LoginFailed(ex); return; } LoginDone(); }; Thread verifyLoginThread = new Thread(actions); verifyLoginThread.Name = "Authentication Thread"; verifyLoginThread.IsBackground = true; verifyLoginThread.Start(); }
private void CreateUser() { // set the status label to inform the user of whats happening statusLabel.ForeColor = defaultLabelColor; statusLabel.Text = "Creating new account..."; statusLabel.Visible = true; // disable the log in button so the user doesnt double tap it createAccountOkButton.Enabled = false; ThreadStart actions = delegate { try { string username = usernameTextBox.Text; string password = passwordTextBox.Text; bool success = FollwitApi.CreateUser(username, password, emailTextBox.Text, "en", privateCheckBox.Checked, ApiUrl); if (success) { api = FollwitApi.Login(username, FollwitApi.HashPassword(password), ApiUrl); ValidatedUser = api.User; } else { api = null; ValidatedUser = null; } } catch (Exception ex) { UnexpectedError(ex); return; } CreateUserDone(); }; Thread verifyLoginThread = new Thread(actions); verifyLoginThread.Name = "Authentication Thread"; verifyLoginThread.IsBackground = true; verifyLoginThread.Start(); }
private void LoginExistingUserPanel_VisibleChanged(object sender, EventArgs e) { if (Visible) { ClearStatus(); usernameTextBox.Focus(); usernameTextBox.Text = ""; passwordTextBox.Text = ""; ValidatedUser = null; api = null; if (ParentForm != null) { this.ParentForm.AcceptButton = signInOkButton; this.ParentForm.CancelButton = backButton; backButton.DialogResult = DialogResult.None; } } else { if (ParentForm != null) { this.ParentForm.AcceptButton = null; this.ParentForm.CancelButton = null; } } }