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