title: ASP.NET Identity Password Validation
body: <p>I am using Identity in my MVC project, and it's all well and nice. Except the fact that the form for registering a new user has some crazy password requirements</p>
  
  <blockquote>
    <p>Passwords must have at least one non letter or digit character. Passwords must have at least one digit <code>('0'-'9')</code>. Passwords must have at least one uppercase <code>('A'-'Z')</code>.</p>
  </blockquote>
  
  <p><strong>And here is the register model</strong></p>
  
  <pre><code>public class RegisterViewModel
  {
      [Required]
      [StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 2)]
      [Display(Name = "First Name")]
      public string FirstName { get; set; }
  
      [Required]
      [StringLength(50, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 2)]
      [Display(Name = "Last Name")]
      public string LastName { get; set; }
  
      [Required]
      [EmailAddress]
      [Display(Name = "Email")]
      public string Email { get; set; }
  
      [Required]
      [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
      [DataType(DataType.Password)]
      [Display(Name = "Passord")]
      public string Password { get; set; }
  
      [DataType(DataType.Password)]
      [Display(Name = "Repeat Password")]
      [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
      public string ConfirmPassword { get; set; }
  }
  </code></pre>
  
  <p><strong>Account Controller</strong></p>
  
  <pre><code>    // POST: /Account/Register
      [HttpPost]
      [AllowAnonymous]
      [ValidateAntiForgeryToken]
      public async Task&lt;ActionResult&gt; Register(RegisterViewModel model)
      {
          if (ModelState.IsValid)
          {
              var user = new ApplicationUser { UserName = model.Email, Email = model.Email };
              var result = await UserManager.CreateAsync(user, model.Password);
              if (result.Succeeded)
              {
                  await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false);
                  return RedirectToAction("Index", "Home");
              }
              AddErrors(result);
          }
  
          // If we got this far, something failed, redisplay form
          return View(model);
      }
  </code></pre>
  
  <p>I see the length requirement for the password, but I don't understand how to change the password validation so I don't need a non letter or digit character.</p>
  
  <p>All help greatly appreciated, thank you.</p>
  
  <p>Bonus: What does the <code>{0}</code> and <code>{2}</code> mean? Thank you.</p>