private bool CheckInput() { if (string.IsNullOrEmpty(oldPassword.Text.Trim())) { oldPassword.Focus(); tip.Show("必须输入", oldPassword, 1000); return(false); } else if (string.IsNullOrEmpty(newPassowrd.Text.Trim())) { newPassowrd.Focus(); tip.Show("必须输入", newPassowrd, 1000); return(false); } else if (string.IsNullOrEmpty(ConfirmPassword.Text.Trim())) { ConfirmPassword.Focus(); tip.Show("必须输入", ConfirmPassword, 1000); return(false); } else { return(true); } }
public UpdatePasswordPage() { InitializeComponent(); this.BindingContext = new ViewModel.UpdatePasswordViewModel(); Password.Completed += (s, e) => NewPassword.Focus(); NewPassword.Completed += (s, e) => ConfirmPassword.Focus(); ConfirmPassword.Completed += (s, e) => { var current = this.BindingContext as ViewModel.UpdatePasswordViewModel; current.UpdateCommand.Execute(null); Password.Focus(); }; }
public RegistrationPage() { var scroll = new ScrollView(); Content = scroll; var rvm = new RegistrationViewModel(); this.BindingContext = rvm; rvm.DisplayInvalidLoginPrompt += () => DisplayAlert("Error", "Username or Password Already Exist, try again", "OK"); InitializeComponent(); Name.Completed += (object sender, EventArgs e) => { PhoneNumber.Focus(); }; PhoneNumber.Completed += (object sender, EventArgs e) => { Email.Focus(); }; Email.Completed += (object sender, EventArgs e) => { Password.Focus(); }; Password.Completed += (object sender, EventArgs e) => { ConfirmPassword.Focus(); }; ConfirmPassword.Completed += (object sender, EventArgs e) => { rvm.SubmitCommand.Execute(null); }; }
public CreateAccountPage(RequestCreator requestCreator) : base(requestCreator) { InitializeComponent(); //Automatically go to next loginstep Username.Completed += (s, a) => Password.Focus(); Password.Completed += (s, a) => ConfirmPassword.Focus(); ConfirmPassword.Completed += (s, a) => NameSearch.Focus(); //Show error message if Password and ConfirmPassword is not the same ConfirmPassword.TextChanged += (s, a) => ConfirmPasswordErrorText.IsVisible = (Password.Text != ConfirmPassword.Text); //Calls NotOnListCheckChanged if Checkbox is clicked NotOnList.CheckedChanged += (s, a) => NotOnListCheckChanged(NotOnList.IsChecked); //If Username is taken Username gets focus CreateAccountButton.Clicked += (s, a) => { UsernameError.Focus(); Username.Focus(); }; // Allow user to click on label to tick checkbox var notOnListLabelTap = new TapGestureRecognizer(); notOnListLabelTap.Tapped += (s, a) => NotOnList.IsChecked = !NotOnList.IsChecked; NotOnListLabel.GestureRecognizers.Add(notOnListLabelTap); //If search text is changed the selected player is unselected NameSearch.TextChanged += (s, a) => _vm.PlayerUnselect(); //Sets BindingContext ViewModel _vm = new CreateAccountViewModel(requestCreator, Navigation); BindingContext = _vm; _vm.Navigation = Navigation; }
private bool IsValidate() { if (NewPassword.Text.Trim() == string.Empty) { MessageBox.Show("New Password is Required.", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); NewPassword.Focus(); return(false); } if (ConfirmPassword.Text.Trim() == string.Empty) { MessageBox.Show("confirm Password is Required.", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); ConfirmPassword.Focus(); return(false); } if (NewPassword.Text.Trim() != ConfirmPassword.Text.Trim()) { MessageBox.Show("Confirm Password doesn't match.", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); ConfirmPassword.Focus(); return(false); } return(true); }
private void Button1_Click(System.Object sender, System.EventArgs e) { try { int RowsAffected = 0; if (Strings.Len(Strings.Trim(cmbUserType.Text)) == 0) { MessageBox.Show("Please select user type", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbUserType.Focus(); return; } if (Strings.Len(Strings.Trim(UserName.Text)) == 0) { MessageBox.Show("Please enter user name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserName.Focus(); return; } if (Strings.Len(Strings.Trim(OldPassword.Text)) == 0) { MessageBox.Show("Please enter old password", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); OldPassword.Focus(); return; } if (Strings.Len(Strings.Trim(NewPassword.Text)) == 0) { MessageBox.Show("Please enter new password", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); NewPassword.Focus(); return; } if (Strings.Len(Strings.Trim(ConfirmPassword.Text)) == 0) { MessageBox.Show("Please confirm new password", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); ConfirmPassword.Focus(); return; } if (NewPassword.TextLength < 5) { MessageBox.Show("The New Password Should be of Atleast 5 Characters", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error); NewPassword.Text = ""; ConfirmPassword.Text = ""; NewPassword.Focus(); return; } else if (NewPassword.Text != ConfirmPassword.Text) { MessageBox.Show("Password do not match", "Input error", MessageBoxButtons.OK, MessageBoxIcon.Error); NewPassword.Text = ""; OldPassword.Text = ""; ConfirmPassword.Text = ""; OldPassword.Focus(); return; } else if (OldPassword.Text == NewPassword.Text) { MessageBox.Show("Password is same..Re-enter new password", "Input error", MessageBoxButtons.OK, MessageBoxIcon.Error); NewPassword.Text = ""; ConfirmPassword.Text = ""; NewPassword.Focus(); return; } con = new OleDbConnection(ck); con.Open(); string co = "update Registration set user_password = '******'where username='******' and user_password = '******' and usertype='" + cmbUserType.Text + "'"; cmd = new OleDbCommand(co); cmd.Connection = con; RowsAffected = cmd.ExecuteNonQuery(); if (RowsAffected > 0) { MessageBox.Show("Successfully changed", "Password", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); My.MyProject.Forms.Frmlogin.Show(); My.MyProject.Forms.Frmlogin.cmbUserType.Text = ""; My.MyProject.Forms.Frmlogin.txtUsername.Text = ""; My.MyProject.Forms.Frmlogin.txtPassword.Text = ""; My.MyProject.Forms.Frmlogin.cmbUserType.Focus(); } else { MessageBox.Show("invalid user name or password", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserName.Text = ""; NewPassword.Text = ""; OldPassword.Text = ""; ConfirmPassword.Text = ""; UserName.Focus(); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async void SignUpProcess(object sender, EventArgs e) { if (string.IsNullOrEmpty(Name.Text) || string.IsNullOrEmpty(Email.Text) || string.IsNullOrEmpty(Password.Text) || string.IsNullOrEmpty(ConfirmPassword.Text)) { if (string.IsNullOrEmpty(Name.Text)) { Frame1.BorderColor = Color.Red; } if (string.IsNullOrEmpty(Email.Text)) { Frame2.BorderColor = Color.Red; } if (string.IsNullOrEmpty(Password.Text)) { Frame3.BorderColor = Color.Red; } if (string.IsNullOrEmpty(ConfirmPassword.Text)) { Frame4.BorderColor = Color.Red; } await DisplayAlert("Error", "Missing fields.", "Okay"); } else if (!Password.Text.Equals(ConfirmPassword.Text)) { await DisplayAlert("Error", "Passwords don't match.", "Okay"); ConfirmPassword.Text = string.Empty; ConfirmPassword.Focus(); } else { ToggleIndicator(true); FirebaseAuthResponseModel res = new FirebaseAuthResponseModel() { }; res = await DependencyService.Get <iFirebaseAuth>().SignUpWithEmailPassword(Name.Text, Email.Text, Password.Text); if (res.Status == true) { try { await CrossCloudFirestore.Current .Instance .Collection("users") .Document(dataClass.loggedInUser.uid) .SetAsync(dataClass.loggedInUser); await DisplayAlert("Success", res.Response, "Okay"); await Navigation.PopAsync(); } catch (Exception ex) { await DisplayAlert("Error", ex.Message, "Okay"); } } else { await DisplayAlert("Error", res.Response, "Okay"); } ToggleIndicator(false); } }
public ConfirmPasswordWindow() { this.InitializeComponent(); Activated += (sender, args) => ConfirmPassword.Focus(); }
private void Password_Leave(object sender, EventArgs e) { ConfirmPassword.Text = ""; ConfirmPassword.UseSystemPasswordChar = true; ConfirmPassword.Focus(); }
private void button1_Click(object sender, EventArgs e) { password = ConfirmPassword.Text; //string encryptedPassword = Encrypt(password); int phoneNumber = PhoneText.Text.Length; int passLength = PasswordText.Text.Length; string gender = ""; if (MaleButton.Checked) { gender = MaleButton.Text; } if (FemaleButton.Checked) { gender = FemaleButton.Text; } //this.Hide(); //Home ss = new Home(); // ss.Show(); //check field empty or not if (string.IsNullOrEmpty(NameTextBox.Text) == true) { MessageBox.Show("Please enter First Name"); NameTextBox.Focus(); } else if (string.IsNullOrEmpty(LastNameTextBox.Text) == true) { MessageBox.Show("Please enter Last Name"); LastNameTextBox.Focus(); } else if (string.IsNullOrEmpty(EmailTextBox.Text) == true) { MessageBox.Show("Please enter Email"); EmailTextBox.Focus(); } else if (Regex.IsMatch(EmailTextBox.Text, emailValStr) == false) { MessageBox.Show("Invalid email!!"); EmailTextBox.Focus(); } else if (string.IsNullOrEmpty(StudentIDTextBox.Text) == true) { MessageBox.Show("Please enter your ID"); StudentIDTextBox.Focus(); } else if (string.IsNullOrEmpty(PhoneText.Text) == true) { MessageBox.Show("Please enter Phone Number"); PhoneText.Focus(); } else if (phoneNumber != 11) { MessageBox.Show("Please enter valid phone number"); PhoneText.Focus(); } else if (string.IsNullOrEmpty(gender) == true) { MessageBox.Show("Please select gender"); ConfirmPassword.Focus(); } else if (string.IsNullOrEmpty(PasswordText.Text) == true) { MessageBox.Show("Please type Password"); PasswordText.Focus(); } else if (passLength <= 8) { MessageBox.Show(Convert.ToString(passLength)); MessageBox.Show("Your password should contain minimum 8 characters or numbers"); PasswordText.Focus(); } else if (string.IsNullOrEmpty(ConfirmPassword.Text) == true) { MessageBox.Show("Please type Password again"); ConfirmPassword.Focus(); } else if (PasswordText.Text != ConfirmPassword.Text) { MessageBox.Show("You typed the wrond password"); PasswordText.Focus(); } else { // conn.ConnectionString = @"Data Source=LAPTOP-UDPCMQEF;Initial Catalog=LibraryManagementSystem;Integrated Security=True"; // conn.Open(); SqlCommand cmd = new SqlCommand("insert into Person" + "(first_name,last_name,password,email,student_id,gender,contact_no) values (@first_name,@last_name,aes_encrypt(@password, 'key'),@email,@student_id,@gender,@contact_no)", connDB.getConn()); cmd.Parameters.AddWithValue("@first_name", NameTextBox.Text); cmd.Parameters.AddWithValue("@last_name", LastNameTextBox.Text); cmd.Parameters.AddWithValue("@email", EmailTextBox.Text); cmd.Parameters.AddWithValue("@student_id", StudentIDTextBox.Text); cmd.Parameters.AddWithValue("@gender", gender); cmd.Parameters.AddWithValue("@contact_no", PhoneText.Text); cmd.Parameters.AddWithValue("@password", password); cmd.ExecuteNonQuery(); MessageBox.Show("You are registered now"); } }
async void SavePasswordClicked(object sender, EventArgs args) { if (string.IsNullOrEmpty(CurrentPassword.Text)) { await dialogService.ShowMessage("Error", "You must enter the current password."); CurrentPassword.Focus(); return; } if (string.IsNullOrEmpty(NewPassword.Text)) { await dialogService.ShowMessage("Error", "You must enter the new password."); NewPassword.Focus(); return; } if (string.IsNullOrEmpty(ConfirmPassword.Text)) { await dialogService.ShowMessage("Error", "You must enter the confirm password."); ConfirmPassword.Focus(); return; } if (!employee.Password.Equals(CurrentPassword.Text)) { await dialogService.ShowMessage("Error", "Current passwword incorrect"); CurrentPassword.Focus(); return; } if (!NewPassword.Text.Equals(ConfirmPassword.Text)) { await dialogService.ShowMessage("Error", "New password and confirm password must be equals"); NewPassword.Focus(); return; } var checkConnetion = await apiService.CheckConnection(); if (!checkConnetion.IsSuccess) { await dialogService.ShowMessage("Error", checkConnetion.Message); return; } var urlAPI = Application.Current.Resources["URLAPI"].ToString(); var changePassword = new ChangePasswordRequest { Email = employee.Email, CurrentPassword = CurrentPassword.Text, NewPassword = NewPassword.Text, }; var response = await apiService.PostPassword <ChangePasswordRequest>( urlAPI, "/api", "/Employees/ChangePassword", employee.TokenType, employee.AccessToken, changePassword); if (!response.IsSuccess) { await dialogService.ShowMessage("Error", response.Message); return; } mainViewModel.Employee.Password = changePassword.NewPassword; dataService.DeleteAllAndInsert(mainViewModel.Employee); await dialogService.ShowMessage("Accept", "Password has been successfully"); PasswordModal.IsVisible = false; }