Class: Fortifier::AuthSteps::InitializeAuthAttempt

Inherits:
Object
  • Object
show all
Defined in:
app/models/fortifier/auth_steps/initialize_auth_attempt.rb

Class Method Summary collapse

Class Method Details

.invoke(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/fortifier/auth_steps/initialize_auth_attempt.rb', line 4

def self.invoke(params)
     secret = params[:secret]
     auth_user = AuthUser.where(login: params[:login]).where(deleted: 0).first
	auth_success = (secret.blank? || auth_user.blank? || auth_user.deleted? ) ? false : auth_user.authenticated?(secret)
 		auth_log = Fortifier::AuthLog.create(auth_user: auth_user,
                                    		     user_agent: params[:user_agent],
                                    		     remote_addr: params[:remote_addr],
                                    		     status: (auth_success ? 1 : 0))

 		params.merge! auth_user: auth_user,
 								    auth_log: auth_log,
 								    auth_msg: (auth_user && auth_success) ? nil : Messaging::NO_AUTH_USER
end