Class: Back::AuthenticationController

Inherits:
BackController
  • Object
show all
Defined in:
app/controllers/lato_core/back/authentication_controller.rb

Overview

AuthenticationController

Instance Method Summary collapse

Instance Method Details

#exec_loginObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/lato_core/back/authentication_controller.rb', line 14

def 
  @superuser = LatoCore::Superuser.find_by(username: params[:username])
  return unless check_superuser_exist

  # check superuser is authenticated
  unless @superuser.authenticate(params[:password])
    flash[:danger] = LANGUAGES[:lato_core][:flashes][:uncorrect_password]
    redirect_to lato_core.
    return
  end

  # save user login on database and create session
  @superuser.(request.remote_ip)
  core__create_superuser_session(@superuser, 1.days.from_now)
  redirect_to lato_core.dashboard_path
end

#exec_logoutObject



31
32
33
34
35
# File 'app/controllers/lato_core/back/authentication_controller.rb', line 31

def exec_logout
  core__destroy_superuser_session
  flash[:success] = LANGUAGES[:lato_core][:flashes][:logout_success]
  redirect_to lato_core.
end

#indexObject



10
11
12
# File 'app/controllers/lato_core/back/authentication_controller.rb', line 10

def index
  redirect_to lato_core.dashboard_path if core__check_superuser_session_valid
end