问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/3034784/adding-confirmable-module-to-an-existing-site-using-devise