lynndylanhurley / lynndylanhurley/devise_token_auth

current_password is not being validated while changing password

Open
#1,068 6 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
3.6k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am using Rails 5, Devise 4.3.0 and devise_token_auth 0.1.42.

I want to allow user to change his password on separate view. This view contains current_password, password and password_confirmation.

So, as per requirement, it should check current_password before updating the password. I've also set following as suggested in config file:

config.check_current_password_before_update = :password
But it's not working. It's throwing error unknown attribute 'current_password' for User.
To get rid of this error, I used this: attr_accessor :current_password

Now, when I try to update password, it's being updated but not validating current_password. If I enter wrong current_password, it's updating new password.

Any help on this would be highly appreciable.

Thanks :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the password update through the separate view using Rails 5, Devise 4.3.0, and devise_token_auth 0.1.42. Inspect how config.check_current_password_before_update and User's current_password are handled, then verify that an incorrect current password prevents the new password from being saved.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api, authentication, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.