0
votes

I am using confirmable in one of the user models , however the idea is different here . The user isn't required to confirm his account on the time of sign-up , he can confirm it later by clicking on confirm .I have read the devise documentation but didn't found any part suitable to my scenario . Can anyone please provide any links or suggestions for the same . Thanks in advance :)

Update -

The user will be able to login into his account and do all kinds of operations without confirming his e-mail . But confirming his mail would add a tag named confirmed to his account . This is what i am trying to do .

1
Could you specify the behaviour you want a little more precisely? Should they be able to log in? By "clicking on confirm", do you mean just mean the confirmation link in the email, or do you mean a confirmation button on your site which they can see if they can log in? If you want them to be able to log in before confirming, do you want a time limit on how long they can do that?Tim
@Tim - i have read up on skip_confirmation during sign_up but i don't know if i can use the confirm option again later on when i need to verify the confirm account .user3620005

1 Answers

0
votes

I think you can do what you want by setting allow_unconfirmed_access_for to nil in your devise.rb initialiser:

config.allow_unconfirmed_access_for = nil

The confirmation email will still be sent, but they will not be required to click on the link before being able to log in. They can click the link at any time in the future and when they do, the confirmed_at time in their user record will be set and user.confirmed? will then returntrue`.

Make sure you haven't set confirm_within in your devise.rb initialiser, or if it is there, make sure it's nil. I don't think it's in there by default, but might be worth checking if you have trouble.

UPDATE

As you don't want to send the email, you need to call skip_confirmation_notification! during your signup process and also if they can edit their email address and you are using reconfirmable. This means that the email won't be sent, but the account will still need confirmation. However, because you've set allow_unconfirmed_access_for to nil, it won't be necessary. Then you could provide a button or something on your site when they're logged in to let them send the email and when it's clicked you'd need to call current_user.send_confirmation_instructions.