title: Rails 4 / Devise Force User to change password on first login
body: <p>Im having a weird issue trying to force my users to change their passwords on first login. </p>
  
  <p>My server output is telling me it completed the patch successfully, however when I go to log back into the app its still the old password? I'll post output below. </p>
  
  <p>But first here is my code to make this happen:</p>
  
  <pre><code>#application_controller.rb
        # Force PW Change On 1st Login
        def after_sign_in_path_for(resource)
          if current_user.sign_in_count == 1
            edit_passwords_path
          else
            authenticated_root_path
          end
        end
  
  
  
  #passwords_controller.rb
    def edit
      @user = current_user
    end
  
    def update
      if current_user.update_without_password(user_params)
        flash[:notice] = "Password updated successfully."
        redirect_to authenticated_root_path
      else
        flash[:alert] = "There was a problem, please try again."
        render :edit
      end
    end
  
    private
      def user_params
        params.require(:user).permit(:password, :password_confirmation)
      end
  
  
  #passwords form_for
  &lt;%= form_for current_user, url: passwords_path do |f| %&gt;
    password:&lt;br /&gt;
    &lt;%= f.password_field :password %&gt;&lt;br /&gt;
    password_confirmation:&lt;br /&gt;
    &lt;%= f.password_field :password_confirmation %&gt;&lt;br /&gt;
    &lt;br /&gt;
    &lt;%= f.submit %&gt;
  &lt;% end %&gt;
  
  #routes.rb
  resource :passwords
  </code></pre>
  
  <p>The force password is doing everything it is supposed to except actually saving the new passwords. </p>
  
  <p>my server output:</p>
  
  <pre><code>Started PATCH "/passwords" for ::1 at 2016-09-07 02:23:43 -0600
  Processing by PasswordsController#update as HTML
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"zUOrOdquBht6uwvjvBkPj2yaO0dCgL+3XGhKo0YV1+W/4rEEiiIRHwwOzRCqvSVeVkAO0M7c73ogcmgNQDq/DQ==", "user"=&gt;{"password"=&gt;"[FILTERED]", "password_confirmation"=&gt;"[FILTERED]"}, "commit"=&gt;"Update User"}
    User Load (0.5ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
     (0.1ms)  BEGIN
     (0.1ms)  COMMIT
  Redirected to http://localhost:3000/
  Completed 302 Found in 5ms (ActiveRecord: 0.7ms)
  
  
  Started GET "/" for ::1 at 2016-09-07 02:23:43 -0600
    User Load (0.4ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
  Processing by WelcomeController#index as HTML
    Rendering welcome/index.html.erb within layouts/application
    Rendered welcome/index.html.erb within layouts/application (0.4ms)
    Rendered layouts/navigation/_unassigned.html.erb (0.5ms)
    Rendered layouts/messages/_flash_msg.html.erb (0.5ms)
  Completed 200 OK in 56ms (Views: 54.9ms | ActiveRecord: 0.0ms)
  </code></pre>