Skip to content

Commit

Permalink
Removed User#initialize_confirmation_token from before_save; added #g…
Browse files Browse the repository at this point in the history
…enerate_confirmation_token to before_create
  • Loading branch information
rmm5t committed Feb 16, 2010
1 parent 58e05e2 commit 1448735
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/clearance/user.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ module Callbacks
def self.included(model) def self.included(model)
model.class_eval do model.class_eval do
before_save :initialize_salt, before_save :initialize_salt,
:encrypt_password, :encrypt_password
:initialize_confirmation_token before_create :generate_confirmation_token

after_create :send_confirmation_email, :unless => :email_confirmed? after_create :send_confirmation_email, :unless => :email_confirmed?
end end
end end
Expand Down Expand Up @@ -165,10 +164,6 @@ def generate_remember_token
self.remember_token = encrypt("--#{Time.now.utc}--#{encrypted_password}--#{id}--") self.remember_token = encrypt("--#{Time.now.utc}--#{encrypted_password}--#{id}--")
end end


def initialize_confirmation_token
generate_confirmation_token if new_record?
end

def password_required? def password_required?
encrypted_password.blank? || !password.blank? encrypted_password.blank? || !password.blank?
end end
Expand Down

0 comments on commit 1448735

Please sign in to comment.