title: Change password length in MVC 5 Membership
body: <p>Trying to change the default minimum password length to 4 characters.  I know, 4!!! Ridiculous, right! Not my call.</p>
  
  <p>Anyway, I've changed it on the <code>RegisterViewModel</code> but that doesn't actually change it. To illustrate I've posted the code below.  The <code>ModleState.IsValid</code> returns correctly based on the updated ViewModel.  However it then calls <code>UserManager.CreateAsync()</code> which returns <code>False</code> with an error message of "Passwords must be at least 6 characters"</p>
  
  <p>I've followed the steps in this, very, similar post(<a href="https://stackoverflow.com/questions/14721378/change-password-length-in-membership-api">Change Password...</a>) but it does not work for MVC 5 as far I as I can tell.  It still returns the same message.</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.UserName, LastLogin = model.LastLogin };
  
  
  // This is where it 'fails' on the CreateAsync() call
                      var result = await UserManager.CreateAsync(user, model.Password);
                      if (result.Succeeded)
                      {
                          await SignInAsync(user, isPersistent: false);
                          return RedirectToAction("Index", "Home");
                      }
                      else
                      {
                          AddErrors(result);
                      }
                  }
              // If we got this far, something failed, redisplay form
              return View(model);
          }
  </code></pre>