title: How to have users change their passwords after the first login?
body: <p>The website that I have created requires to have Admin accounts create accounts for users. How would I go about having those users change their password after the first time they login? The problem is users will have a generic password designated to them, after they decide to login for the first time I would like them to have to change their password to something that is less generic. </p>
  
  <p><strong>Here is my login controller</strong></p>
  
  <pre><code>  [AllowAnonymous]
      public ActionResult Login(string returnUrl)
      {
          ViewBag.ReturnUrl = returnUrl;
          return View();
      }
  
      //
      // POST: /Account/Login
      [HttpPost]
      [AllowAnonymous]
      [ValidateAntiForgeryToken]
      public async Task&lt;ActionResult&gt; Login(LoginViewModel model, string returnUrl)
      {
          if (ModelState.IsValid)
          {
              var user = await UserManager.FindAsync(model.UserName, model.Password);
              if (user != null)
              {
                  await SignInAsync(user, model.RememberMe);
                  return RedirectToLocal(returnUrl);
              }
  
              else
              {
                  ModelState.AddModelError("", "Invalid username or password.");
              }
  
          }
  </code></pre>
  
  <p><strong>My login Model</strong></p>
  
  <pre><code> public class LoginViewModel
  {
      [Required]
      [Display(Name = "User name")]
      public string UserName { get; set; }
  
      [Required]
      [DataType(DataType.Password)]
      [Display(Name = "Password")]
      public string Password { get; set; }
  
      [Display(Name = "Remember me?")]
      public bool RememberMe { get; set; }
  
  
  
  }
  </code></pre>
  
  <p><strong>And the view</strong></p>
  
  <pre><code> &lt;div class="container"&gt;
      &lt;div class="col-md-8"&gt;
          &lt;section id="loginForm"&gt;
              @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
              {
                  @Html.AntiForgeryToken()
                  &lt;h4&gt;Use a local account to log in.&lt;/h4&gt;
                  &lt;hr /&gt;
                  @Html.ValidationSummary(true)
                  &lt;div class="form-group"&gt;
                      @Html.LabelFor(m =&gt; m.UserName, new { @class = "col-md-2 control-label" })
                      &lt;div class="col-md-10"&gt;
                          @Html.TextBoxFor(m =&gt; m.UserName, new { @class = "form-control" })
                          @Html.ValidationMessageFor(m =&gt; m.UserName)
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      @Html.LabelFor(m =&gt; m.Password, new { @class = "col-md-2 control-label" })
                      &lt;div class="col-md-10"&gt;
                          @Html.PasswordFor(m =&gt; m.Password, new { @class = "form-control" })
                          @Html.ValidationMessageFor(m =&gt; m.Password)
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;div class="col-md-offset-2 col-md-10"&gt;
                          &lt;div class="checkbox"&gt;
                              @Html.CheckBoxFor(m =&gt; m.RememberMe)
                              @Html.LabelFor(m =&gt; m.RememberMe)
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="form-group"&gt;
                      &lt;div class="col-md-offset-2 col-md-10"&gt;
                          &lt;input type="submit" value="Log in" class="btn btn-default" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  </code></pre>