未确认时设计登录成功

时间:2010-12-14 01:29:55

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

你能告诉我如何整合确认的吗?属性进入会话登录过程?

我已经设置了一个带有可确认和可验证的设计的应用程序... 但我可以使用未确认的用户模型登录!

更新

我在迁移过程中注释掉了可确认部分。

  # schema.rb
  create_table "users", :force => true do |t|
    t.string   "email",                                        :default => "", :null => false
    t.string   "encrypted_password",            :limit => 128, :default => "", :null => false
    t.string   "password_salt",                                :default => "", :null => false
    t.string   "confirmation_token"
    t.datetime "confirmed_at"
    t.datetime "confirmation_sent_at"
    ....
  end

# user.rb
class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, 
         :confirmable, :lockable, :timeoutable, :token_authenticatable
  ...
end

# routes.rb
devise_for :users, :controllers => { :passwords => "password_resets" } do
  # this doesnt matter to my mentioned problem
  get "instruction", :to => "password_resets#instruction", :path => "/users/password/instruction", :as => "instruction_user_password"
end

1 个答案:

答案 0 :(得分:1)

糟糕...

我在devise.rb中设置了错误的配置

  # ==> Configuration for :confirmable
  # 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 nil.
  # 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

  # i didnt read that the user has access in this time