2012-02-20 58 views
1

我是一个rails新手。我第一次使用Devise时遇到了一些奇怪的事情。你能不能让我知道这是否是一个设计错误或我的问题?问题与设计电子邮件确认

我使用的设计2.0.1

新用户注册后,邮件被发送到注册的电子邮件地址。

案例1:

这部分是好的

通过电子邮件链接一旦确认,他是能够访问整个网站。

案例2:

这部分也不行

后,我报名,我马上不点击确认链接,我去页签,并尝试以登录刚创建的电子邮件帐户和密码,它显示任何错误,它只是路由到sign_in网页..理想我想它显示错误类似

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

案例3:

这部分也不行

后,我报名,我点击忘记密码LNK。我输入了我刚注册的电子邮件地址..它向我发送重置密码说明。我不想重置密码说明,而是希望向我发送一条错误消息,说"Email first has to been confirmed first in order to send reset password instructions."

期待您的帮助和支持。

感谢

回答

2

如果我需要让人们了解确认,我通常在我的控制器之一进行设置:

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

这将阻止人们做任何事情,除非他们已经证实,并限制要求决定我放在哪里。例如,如果你想阻止人们做所有事情,直到他们确认了,把它放在application_controller的before_filter中。如果您希望他们停止创建帖子,请将其置于帖子控制器中。

对于这个工作,你真的还应该改变“config.confirm_within”在devise.rb配置文件设置为让人们在默认值:

# ==> 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 
+0

我试着这样做..但我得到一个错误!另外,我不想让用户每天2次访问。我更加关注Devise Bug ..上面提到的Case 3&Case 2 .. – gkolan 2012-02-21 00:59:16