Rails设计1.3.4可确认

时间:2011-05-24 13:58:54

标签: ruby-on-rails-3 devise confirmation

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

当我注册时,邮件已发送,但似乎控制器无法看到该帐户尚未确认并尝试登录。

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 "/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 个答案:

答案 0 :(得分:1)

initializers / 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

这可能是它在注册后尝试登录的原因,如果用户已设置为某个值,则会登录该用户。