Update process phase1

This commit is contained in:
2013-12-17 09:41:35 +01:00
parent b1937f1e38
commit 748944865d
8 changed files with 194 additions and 168 deletions
+30 -1
View File
@@ -12,7 +12,7 @@ class User
property :oauth_expires_at
property :auth_data
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :token_authenticatable, :omniauthable, :omniauth_providers => [:facebook] # , :registerable
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :omniauthable, :omniauth_providers => [:facebook] #, :token_authenticatable , :registerable
property :authentication_token
@@ -58,4 +58,33 @@ class User
def has_active_list?
active_list_id.present?
end
#####################################
# Taken from devise 2.2
#####################################
# Generate new authentication token (a.k.a. "single access token").
def reset_authentication_token
self.authentication_token = self.class.authentication_token
end
# Generate new authentication token and save the record.
def reset_authentication_token!
reset_authentication_token
save(:validate => false)
end
# Generate authentication token unless already exists.
def ensure_authentication_token
reset_authentication_token if authentication_token.blank?
end
# Generate authentication token unless already exists and save the record.
def ensure_authentication_token!
reset_authentication_token! if authentication_token.blank?
end
def self.authentication_token
SecureRandom.hex(24)
end
end