Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_current_password_before_update still requires password when resetting password #526

Closed
paulius005 opened this issue Feb 6, 2016 · 5 comments

Comments

@paulius005
Copy link

I have config.check_current_password_before_update = :password enabled. So when the user updates his/her password, the current_password field is required. This becomes a problem when implementing Password reset because the user does not know his/her current password. How do I bypass this and still require the current_password when the user is not resetting his/her password?

@tmjfitch
Copy link

tmjfitch commented Feb 6, 2016

I've run into the same issue when trying to handle the password reset workflow. Any suggestions?

@paulius005
Copy link
Author

I see this

# ensure that user is confirmed
@resource.skip_confirmation! if @resource.devise_modules.include?(:confirmable) && !@resource.confirmed_at

inside of devise_token_auth/passwords_controller.rb

but update gets called instead of when I use $auth.updatePassword within ng-token-auth and it looks like @resource.allow_password_change = false this may be overriding it

@paulius005
Copy link
Author

Hmm just overrode the controller. Edit sets @resource.allow_password_change to true, so that's fine, by the time update is called @resource.allow_password_change is false again. This makes esnse since instance variables are only live for the duration of the request. So that seems to be an issue, unless I am using something wrong.

Looking for ways around this, only way I can think of is to use a class variable a temporary solution. However, this does not seem ideal since multiple users toggling this could result in some bad collisions.

@paulius005
Copy link
Author

Checked. This situation is not covered by unit tests and is not used in the demo code

@paulius005
Copy link
Author

Currently going to solve by passing another resource_param called :allow and let update set @resource.allow_password_change to true until someone can help with a better solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants