lib/mls/models/account.rb in mls-0.13.0 vs lib/mls/models/account.rb in mls-0.14.0
- old
+ new
@@ -27,11 +27,10 @@
attribute :created_at, DateTime, :serialize => :false
attribute :updated_at, DateTime, :serialize => :false
attribute :email_token, String, :serialize => false
- attribute :auth_cookie, String, :serialize => false
attribute :start_hours_of_operation, Fixnum, :serialize => :if_present
attribute :end_hours_of_operation, Fixnum, :serialize => :if_present
attribute :days_of_operation, String, :serialize => :if_present
attribute :timezone, String, :serialize => :if_present
attribute :lead_status, String, :serialize => :if_present
@@ -127,15 +126,11 @@
#
# Account.authenticate('jon@does.net', 'wrong') # => nil
def authenticate(attrs_or_email, password=nil)
email = attrs_or_email.is_a?(Hash) ? attrs_or_email[:email] : attrs_or_email
password = attrs_or_email.is_a?(Hash) ? attrs_or_email[:password] : password
-
response = MLS.post('/login', {:email => email, :password => password})
- MLS.auth_cookie = response['set-cookie']
-
account = MLS::Account::Parser.parse(response.body)
- account.auth_cookie = MLS.auth_cookie
account
rescue MLS::Exception::Unauthorized => response
nil
end