Разработать вход успешно, когда не подтверждено - PullRequest
0 голосов
/ 14 декабря 2010

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

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

UPDATE

Я прокомментировал подтверждающий раздел в моей миграции.

  # 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 Ответ

1 голос
/ 15 декабря 2010

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
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...