2010-12-14 3 views
0

Не могли бы вы рассказать мне, как интегрировать подтвержденные? атрибут в процесс сеансового входа?Придумать логин успешно, если не подтвержден

Я установил рабочее приложение с разработкой с возможностью подтверждения и аутентификации ... Но я могу войти в систему с пользовательской моделью, которая не подтверждена!

UPDATE

Я закомментировал confirmable сечение в моей миграции.

# 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 => "https://stackoverflow.com/users/password/instruction", :as => "instruction_user_password" 
end 
+0

Сделайте свое вы раскомментировать эти символы в миграции при первоначальном создании своего пользователя. – s84

+0

Я раскоментировал их - см. Мою схему выше ... – Lichtamberg

+0

Это не имеет никакого смысла. Покажите нам, как вы настроили рабочее приложение. Что находится в модели User? –

ответ

0

Argh ...

Я поставил неправильную конфигурацию в 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