2011-05-24 67 views
0

我使用设计与客户端验证并设置了可确认选项。Rails设计1.3.4可确认

当我注册,邮件发送,但似乎控制器是无法看到该帐户尚未得到证实,并尝试登录。

Started GET "/" for 127.0.0.1 at 2011-05-24 14:41:47 +0200 
    Processing by HomeController#index as HTML 
Completed in 156ms 


Started GET "https://stackoverflow.com/users/sign_in" for 127.0.0.1 at 2011-05-24 14:41:47 +0200 
    Processing by Devise::SessionsController#new as HTML 
    SQL (3.5ms) SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull 
FROM pg_attribute a LEFT JOIN pg_attrdef d 
ON a.attrelid = d.adrelid AND a.attnum = d.adnum 
WHERE a.attrelid = '"users"'::regclass 
AND a.attnum > 0 AND NOT a.attisdropped 
ORDER BY a.attnum 

Rendered devise/shared/_links.erb (23.5ms) 
Rendered devise/sessions/new.html.erb within layouts/application (92.2ms) 
Completed 200 OK in 646ms (Views: 117.4ms | ActiveRecord: 3.5ms) 

任何想法去哪里找?

回答

1

有一个在初始化/ devise.rb的结构:

# The time you want to give your user to confirm his account. During this time 
    # he will be able to access your application without confirming. Default is 0.days 
    # When confirm_within is zero, the user won't be able to sign in without confirming. 
    # You can use this to let your user access some features of your application 
    # without confirming the account, but blocking it after a certain period 
    # (ie 2 days). 
    config.confirm_within = 2.days 

也许这是它试图登记后进行登录的原因,并且在用户登录,如果它已被设置为某个值。

+0

我试图强制它为0,但我仍然有问题。我不知道是否可以在某处放置调试点来查看发生了什么。 – 2011-05-24 15:09:51

+0

你面临的问题是什么?它会尝试登录并且无法登录,因为可确定性设置为0天。这是我想的默认行为。 还是你想要它自动登录,用户可以稍后验证? – 2011-05-24 16:45:56

+0

当用户完成订阅时,设计会尝试登录,但由于未确认电子邮件而失败。因此,用户没有被通知他需要检查他的电子邮件,并且他在注册页面上有无关的错误消息。我想让他在成功注册后重定向到特定页面,告诉他检查他的电子邮件。 – 2011-05-24 19:01:10