Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding confirmable module to an existing site using Devise

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

like image 262
slythic Avatar asked Jun 14 '10 03:06

slythic


1 Answers

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.

like image 82
Jade Avatar answered Sep 22 '22 15:09

Jade