app/volt/models/user.rb in volt-0.8.27.beta2 vs app/volt/models/user.rb in volt-0.8.27.beta3
- old
+ new
@@ -1,12 +1,14 @@
-require 'bcrypt' if RUBY_PLATFORM != 'opal'
+unless RUBY_PLATFORM == 'opal'
+ require 'bcrypt'
+end
module Volt
class User < Model
- # returns true if the user configured using the username
+ # returns login field name depending on config settings
def self.login_field
- if Volt.config.public.try(:auth).try(:use_username)
+ if Volt.config.try(:public).try(:auth).try(:use_username)
:username
else
:email
end
end
@@ -22,9 +24,10 @@
def password=(val)
if Volt.server?
# on the server, we bcrypt the password and store the result
self._hashed_password = BCrypt::Password.create(val)
else
+ # Assign the attribute
self._password = val
end
end
end
end