Class: Castronaut::Adapters::Development::User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/castronaut/adapters/development/user.rb

Class Method Summary collapse

Class Method Details

.authenticate(username, password) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/castronaut/adapters/development/user.rb', line 7

def self.authenticate(username, password)
  if user = (username)
    if user.password == password
      Castronaut::AuthenticationResult.new(username, nil)
    else
      Castronaut.config.logger.info "#{self} - Unable to authenticate username #{username} due to invalid authentication information"
      Castronaut::AuthenticationResult.new(username, "Unable to authenticate the username #{username}")
    end
  else
    Castronaut.config.logger.info "#{self} - Unable to authenticate username #{username} because it could not be found"
    Castronaut::AuthenticationResult.new(username, "Unable to authenticate the username #{username}")
  end
end