Class: Session
- Inherits:
-
MLS::Model
- Object
- ActiveRecord::Base
- MLS::Model
- Session
- Defined in:
- lib/mls/models/session.rb
Class Method Summary collapse
-
.authenticate(email_address, password = nil) ⇒ Object
Authenticate with email_address and password.
- .authenticate_by_token(token) ⇒ Object
Class Method Details
.authenticate(email_address, password = nil) ⇒ Object
Authenticate with email_address and password. Returns either the newly created session or nil
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/mls/models/session.rb', line 7 def self.authenticate(email_address, password=nil) if email_address.is_a? Hash password = email_address[:password] email_address = email_address[:email_address] end Session.create!(:email_address => email_address, :password => password) rescue Sunstone::Exception::Unauthorized, ActiveRecord::RecordInvalid nil end |
.authenticate_by_token(token) ⇒ Object
18 19 20 |
# File 'lib/mls/models/session.rb', line 18 def self.authenticate_by_token(token) Session.create(:token => token) end |