From f1ccaf86a4568dec52126cf7995e1966b7e067da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 30 Mar 2012 09:05:58 +0200 Subject: [PATCH] Remember token is not required. --- lib/devise/models/authenticatable.rb | 2 +- lib/devise/models/confirmable.rb | 7 ++----- lib/devise/models/rememberable.rb | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/devise/models/authenticatable.rb b/lib/devise/models/authenticatable.rb index 2d53dd71e6..d6481b7ffd 100644 --- a/lib/devise/models/authenticatable.rb +++ b/lib/devise/models/authenticatable.rb @@ -54,7 +54,7 @@ module Authenticatable BLACKLIST_FOR_SERIALIZATION = [:encrypted_password, :reset_password_token, :reset_password_sent_at, :remember_created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at, :current_sign_in_ip, :last_sign_in_ip, :password_salt, :confirmation_token, :confirmed_at, :confirmation_sent_at, - :unconfirmed_email, :failed_attempts, :unlock_token, :locked_at, :authentication_token] + :remember_token, :unconfirmed_email, :failed_attempts, :unlock_token, :locked_at, :authentication_token] included do class_attribute :devise_modules, :instance_writer => false diff --git a/lib/devise/models/confirmable.rb b/lib/devise/models/confirmable.rb index 41dea36f21..07d6a3576b 100644 --- a/lib/devise/models/confirmable.rb +++ b/lib/devise/models/confirmable.rb @@ -33,15 +33,12 @@ module Confirmable before_create :generate_confirmation_token, :if => :confirmation_required? after_create :send_on_create_confirmation_instructions, :if => :confirmation_required? before_update :postpone_email_change_until_confirmation, :if => :postpone_email_change? - after_update :send_confirmation_instructions, :if => :reconfirmation_required? + after_update :send_confirmation_instructions, :if => :reconfirmation_required? end def self.required_fields(klass) required_methods = [:confirmation_token, :confirmed_at, :confirmation_sent_at] - if klass.reconfirmable - required_methods << :unconfirmed_email - end - + required_methods << :unconfirmed_email if klass.reconfirmable required_methods end diff --git a/lib/devise/models/rememberable.rb b/lib/devise/models/rememberable.rb index 18184c2d3e..b9e433868a 100644 --- a/lib/devise/models/rememberable.rb +++ b/lib/devise/models/rememberable.rb @@ -42,7 +42,7 @@ module Rememberable attr_accessor :remember_me, :extend_remember_period def self.required_fields(klass) - [:remember_created_at, :remember_token] + [:remember_created_at] end # Generate a new remember token and save the record without validations @@ -91,7 +91,7 @@ def rememberable_options protected - def generate_remember_token? + def generate_remember_token? #:nodoc: respond_to?(:remember_token) && remember_expired? end @@ -114,7 +114,7 @@ def serialize_from_cookie(id, remember_token) end # Generate a token checking if one does not already exist in the database. - def remember_token + def remember_token #:nodoc: generate_token(:remember_token) end