Class: Landable::AuthenticationService::EchoAuthenticator

Inherits:
Object
  • Object
show all
Defined in:
app/services/landable/authentication_service.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ EchoAuthenticator

Returns a new instance of EchoAuthenticator.



21
22
23
24
# File 'app/services/landable/authentication_service.rb', line 21

def initialize(username, password)
  @username = username
  @password = password
end

Class Method Details

.call(username, password) ⇒ Object



17
18
19
# File 'app/services/landable/authentication_service.rb', line 17

def self.call(username, password)
  new(nil, nil).call(username, password)
end

Instance Method Details

#call(username, password) ⇒ Object



26
27
28
29
30
# File 'app/services/landable/authentication_service.rb', line 26

def call(username, password)
  return unless acceptable_environment?
  return echo_author(username) if @username.nil? && password != 'fail'
  return echo_author(username) if @username == username && @password == password
end