mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 11:10:12 +01:00
fixing issues with user creation
This commit is contained in:
parent
cf78ad3659
commit
08fb85ef0d
1 changed files with 4 additions and 4 deletions
|
|
@ -192,7 +192,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def generate_token
|
||||
self.token = self.class.sha1 "#{Time.now.to_i}#{rand}"
|
||||
self.token = sha1 "#{Time.now.to_i}#{rand}"
|
||||
end
|
||||
|
||||
def remember_token?
|
||||
|
|
@ -202,7 +202,7 @@ class User < ActiveRecord::Base
|
|||
# These create and unset the fields required for remembering users between browser closes
|
||||
def remember_me
|
||||
self.remember_token_expires_at = 2.weeks.from_now.utc
|
||||
self.remember_token ||= self.class.sha1("#{login}--#{remember_token_expires_at}")
|
||||
self.remember_token ||= sha1("#{login}--#{remember_token_expires_at}")
|
||||
save(false)
|
||||
end
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ class User < ActiveRecord::Base
|
|||
|
||||
def password_matches?(pass)
|
||||
if uses_deprecated_password?
|
||||
crypted_password == User.sha1(pass)
|
||||
crypted_password == sha1(pass)
|
||||
else
|
||||
BCrypt::Password.new(crypted_password) == pass
|
||||
end
|
||||
|
|
@ -241,7 +241,7 @@ protected
|
|||
|
||||
def crypt_password
|
||||
return if password.blank?
|
||||
write_attribute("crypted_password", self.class.hash(password)) if password == password_confirmation
|
||||
write_attribute("crypted_password", hash(password)) if password == password_confirmation
|
||||
end
|
||||
|
||||
def password_required?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue