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

Confirmation Instructions view confirmation_url should use Devise's friendly token instead of token set in database #4

Closed
jiggneshhgohel opened this issue Jan 19, 2015 · 2 comments

Comments

@jiggneshhgohel
Copy link

@hisea First of all Thank you for your valuable contribution. I have used this gem in my project and it
really helped in cutting down the time it would have required to copy the original devise views and then adapt them to Bootstrap.

Recently I encountered an issue related to Confirmation Instructions being sent to a user after she signs up. The confirmation URL in the instructions (the following code) was generating a link with a link with original (encoded) confirmation token in database, instead of the Devise's friendly (raw) token (as mandated in recent versions of Devise).

<p><%= link_to t('.action', :default => "Confirm my account"),
confirmation_url(@resource, :confirmation_token => @resource.confirmation_token, locale: I18n.locale) %></p>

This was making the code Devise.token_generator.digest(self, :confirmation_token, confirmation_token) generate an invalid digest based on received token in Devise's confirm_by_token(confirmation_token) method defined in lib/devise/models/confirmable.rb and hence throwing the error. Fixed this error by using the friendly token in the confirmation url. After this fix user was successfully getting confirmed using the correct confirmation url.

The correct confirmation url should be

confirmation_url(@resource, :confirmation_token => @token, locale: I18n.locale)

References:

Please fix this so that others using your gem don't end up in the same problem I faced.

Thanks,
Jiggneshh

@hisea
Copy link
Owner

hisea commented Jan 19, 2015

Thank you so much for your feedback @jiggneshhgohel.

I'll take a look this week to try fix it. If you'd like, you are always welcome to open a pull request.

@hisea
Copy link
Owner

hisea commented Jan 19, 2015

this actually already fixed by @steigr long time ago. I didn't got the notification. sorry guys, just closed all pull request and preparing for a version release.

@hisea hisea closed this as completed Jan 19, 2015
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