private bool CanExecuteCommand() { MailHintChange(); if (string.IsNullOrWhiteSpace(Name) || string.IsNullOrWhiteSpace(Surname) || string.IsNullOrWhiteSpace(ConfirmPassword) || string.IsNullOrWhiteSpace(Password) || string.IsNullOrWhiteSpace(Email)) { return(false); } return((ConfirmPassword.Equals(Password)) && IsCorrectEmail()); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { //var result = new List<ValidationResult>(); if (ConfirmPassword.Equals(Password) == false) { yield return(new ValidationResult("Passwords do not match", new List <string> { ConfirmPassword })); } }
/// <summary> /// Check Passwords /// </summary> /// <returns></returns> private async Task CheckPasswordAsync() { if (ConfirmPassword.Equals("")) { IsPasswordImageVisible = false; } else { IsPasswordCorrect = ConfirmPassword.Equals(Password); //IsPasswordCorrect = await CheckPasswordsAsync(); IsPasswordImageVisible = true; } }
public string this[string columnName] { get { inputValid = true; if (columnName == "NewPassword") { if (String.IsNullOrEmpty(NewPassword)) { return(null); } if (NewPassword.Length < 6 || NewPassword.Length > 10) { inputValid = false; return(Text.PasswordLength); } bool hasCapital = false; char[] charArray = NewPassword.ToCharArray(); foreach (char c in charArray) { if (Char.IsUpper(c)) { hasCapital = true; break; } } if (!hasCapital) { inputValid = false; return(Text.PasswordRequireCapital); } return(null); } if (columnName == "ConfirmPassword") { if (!String.IsNullOrEmpty(NewPassword) && !String.IsNullOrEmpty(ConfirmPassword) && !ConfirmPassword.Equals(NewPassword)) { inputValid = false; return(Text.PasswordMismatch); } return(null); } return(null); } }
private bool isPasswordOkay() { if (Password.Length < 5) { AlertPasswordTooShort?.Invoke(); return(false); } if (!ConfirmPassword.Equals(Password)) { AlertConfirmationPasswordDidNotMatch?.Invoke(); return(false); } return(true); }
public async Task <bool> ValidateData(HttpContext httpContext) { if (!Email.ValidateEmail()) { await httpContext.Response.SendRequestErrorAsync(1, "The e-mail is invalid or empty."); return(false); } if (!Username.ValidateUsername()) { await httpContext.Response.SendRequestErrorAsync(2, "The username is invalid or too long."); return(false); } if (!Password.ValidatePasswordLength()) { await httpContext.Response.SendRequestErrorAsync(3, "The password is invalid or too small."); return(false); } if (!ConfirmPassword.Equals(Password)) { await httpContext.Response.SendRequestErrorAsync(4, "The password confirmation is not the same as password."); return(false); } if (string.IsNullOrEmpty(Captcha)) { await httpContext.Response.SendRequestErrorAsync(6, "The captcha is invalid or empty."); return(false); } if (!Language.ValidateLanguage()) { await httpContext.Response.SendRequestErrorAsync(7, "The language is invalid or empty."); return(false); } return(true); }
public async Task <IActionResult> OnPostAsync() { ConfirmPasswordErrorMessage = ""; EmailAddressErrorMessage = ""; if (!ModelState.IsValid) { return(Page()); } if (!ConfirmPassword.Equals(ApplicationUser.Password)) { ConfirmPasswordErrorMessage = "Passwords do not match!!"; return(Page()); } try { // The Contains method is run on the database var email = (from u in _context.ApplicationUser where (u.EmailAddress == ApplicationUser.EmailAddress) select u.EmailAddress).Single(); EmailAddressErrorMessage = "An account with this Email Address already exists!!"; return(Page()); } catch (InvalidOperationException) //this error happens if the email address is unique { HashString Hash = new HashString(); ApplicationUser.Password = Hash.ComputeSha256Hash(ApplicationUser.Password); _context.ApplicationUser.Add(ApplicationUser); await _context.SaveChangesAsync(); await this.SignInUser(ApplicationUser.EmailAddress, false); return(RedirectToPage("/AppUser/Profile", new { Id = ApplicationUser.ID })); } }