Adding confirmable module to an existing site using Devise
Asked Answered
M

1

7

I'm using devise for a web app and wanted to add the confirmable module to the site. However, since a confirmation_token isn't generated users can't sign in. When clicking the 'Didn't receive confirmation instructions?' link the token still isn't generated.

Confirmation email just generates this link (notice the lack of token in the url):

<p><a href="http://localhost:3000/users/confirmation">Confirm my account</a></p>

What is the best way to get this to work?

Many thanks,
Tony

Monoicous answered 14/6, 2010 at 3:3 Comment(0)
D
9

I'm looking for the same answer. I suspect the answer may be that the data model includes whether or not each user is confirmed. It appears to add:

confirmation_token, confirmed_at, confirmation_sent_at

Also, the confirmable module appears to add these methods:

:confirmation_token, :confirmation_token=, :confirmation_token?, :confirmation_token_change, :confirmation_token_changed?, :confirmation_token_was, :reset_confirmation_token!, :confirmed_at, :confirmed_at=, :confirmed_at?, :confirmed_at_change, :confirmed_at_changed?, :confirmed_at_was, :reset_confirmed_at!, :confirmation_sent_at, :confirmation_sent_at=, :confirmation_sent_at?, :confirmation_sent_at_change, :confirmation_sent_at_changed?, :confirmation_sent_at_was, :reset_confirmation_sent_at!

So you could do it in the data model layer. I'm using Mongoid, so I just wrote a script that changes confirmed_at for each user to today.

Dictate answered 14/6, 2010 at 13:35 Comment(1)
This will apparently be fixed in Devise 1.0.8. Thankfully I only had to do it to a small set of users in a staging server. Thank you for the answer and help!Monoicous

© 2022 - 2024 — McMap. All rights reserved.