protected override void ValidateCore(Dictionary <string, string> errors)
        {
            base.ValidateCore(errors);
            if (!UserValidationHelper.IsUserNameValid(UserName))
            {
                errors.Add(nameof(UserName), "Username is invalid");
            }

            if (!UserValidationHelper.IsDisplayNameValid(DisplayName))
            {
                errors.Add(nameof(DisplayName), "Display name is invalid");
            }

            if (string.IsNullOrWhiteSpace(Password))
            {
                errors.Add(nameof(Password), "Password field is empty");
            }

            if (string.IsNullOrWhiteSpace(ConfirmedPassword))
            {
                errors.Add(nameof(ConfirmedPassword), "Password field is empty");
            }

            if (Password != ConfirmedPassword)
            {
                errors.Add("", "New and confirmed passwords don't match");
            }
        }
Exemple #2
0
 protected override void ValidateCore(Dictionary <string, string> errors)
 {
     base.ValidateCore(errors);
     if (!UserValidationHelper.IsDisplayNameValid(DisplayName))
     {
         errors.Add(nameof(DisplayName), "Display name is invalid");
     }
 }