1
votes

I am a rails newbie. I encountered something strange when I am using Devise for the first time. Could you please let me know if this is a Devise Bug or an issue on my end?

I am using Devise 2.0.1

After a new user signs up, email is sent to the registered email address.

Case 1:

This part is Ok

Once confirmed through the email link, he is able to access the entire site.

Case 2:

This part is not Ok

After I sign up, I immediately without clicking on the confirm link, I go to sign in page and try to sign in with the just created email account and password, it does not show any error, it simply routes to the sign_in page.. Ideally I would like it to show an error something like

"We have sent you an email. Please confirm. 
If you have not received them please ask for conformation instructions"

Case 3:

This part is not Ok

After I sign up, I click the forgot password lnk. I enter the email address I just signed up with..it sends me a reset password instructions. Instead of reset password instructions, I would ideally like to send me an error saying "Email first has to been confirmed first in order to send reset password instructions."

Looking forward for your help and support.

Thanks

1

1 Answers

2
votes

If I need to let people know about confirmations, I usually set this up in one of my controllers:

render :template => 'shared/unconfirmed' and return if current_user.confirmed? == false

This stops people doing anything unless they have confirmed, and the restriction requirements determine where I put it. For example, if you want to block people doing everything until they have confirmed, put it in a before_filter in your application_controller. If you want them to stop creating Posts, put it in the Posts controller.

For this to work, you'll really should also change the default value of "config.confirm_within" setting in the devise.rb config file to let people in:

# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming his account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming his account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming his account.
# config.confirm_within = 2.days