We've moved discussions to Discord

Update Password Bug?

Dan Tappin
Can anyone update their password?

Screen Shot 2019-08-14 at 11.57.52 AM.png 123 KB

I enter my old password and a new one and get this no matter what.  This is the stock install with new user registrations enabled.
Dan Tappin
Chris Oliver I squashed this bug:

  • The redirect was wrong
  • The params were missing the require(:user)

module Account
  class PasswordsController < ApplicationController
    before_action :authenticate_user!

    def show
      redirect_to action: :edit
    end

    def edit
    end

    def update
      if current_user.update_with_password(password_params)
        bypass_sign_in current_user
        redirect_to edit_account_password_path, notice: "Your password was changed successfully"
      else
        render action: :edit
      end
    end

    private

      def password_params
        params.require(:user).permit(:current_password, :password, :password_confirmation)
      end
  end
end
Dan Weaver
Looks like this was fixed in the official repo a few weeks ago 👍
https://gitlab.com/gorails/jumpstart-pro/commit/f938570facb174ba1360cdc7a5d5ff21b923e66f
Notifications
You’re not receiving notifications from this thread.