title: Completed 401 Unauthorized after updating password with devise
body: <p>When I try to update the user password I have : </p>
  
  <blockquote>
    <blockquote>
      <p>Completed 401 Unauthorized in 3ms (ActiveRecord: 0.6ms)</p>
    </blockquote>
  </blockquote>
  
  <p>The update happen properly but then I'm logged out. I would like to stay log after this update.</p>
  
  <p>I use the <code>update with password</code> method from devise.</p>
  
  <p><strong>Registrations_controller</strong></p>
  
  <pre><code> def update_password
      @user = current_user
      authorize @user, :update?
      if @user.update_with_password(user_params)
        flash[:success] = t 'edit.success'
      else
        flash[:error] = t 'flash.error_occured'
      end
      redirect_to edit_user_registration_path + "##{t('users.account.title')}"
    end
  
  private
  
  def user_params
      params.require(:user).permit(
        :current_password, :password, :email, :username )
  end
  </code></pre>
  
  <p>view code:</p>
  
  <pre><code>  = form_for @user, url: update_password_path, html: { method: :put, role: 'form'} do |f|
      = devise_error_messages!
  
      = f.label t ('password.current')
      = f.password_field :current_password, autocomplete: :off
  
      = f.label t('password.new')
      = f.password_field :password, autocomplete: :off
  
      = f.submit t('button.change'), data: { disable_with: t('ajaxdoing') }
  </code></pre>