Class: Hello::Authentication::SudoModeController

Inherits:
Hello::ApplicationController show all
Defined in:
app/controllers/hello/authentication/sudo_mode_controller.rb

Instance Method Summary collapse

Instance Method Details

#authenticateObject

PATCH /hello/sudo_mode



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/hello/authentication/sudo_mode_controller.rb', line 12

def authenticate
  business = Business::Authentication::SudoModeAuthentication.new(current_access)

  if business.authenticate!(password_param)
    path_to_go = session[:url] || root_path
    flash[:notice] = business.success_message
    redirect_to path_to_go
  else
    flash.now[:alert] = business.alert_message
    render_sudo_mode_form
  end
end

#expireObject

GET /hello/sudo_mode/expire



26
27
28
29
30
31
# File 'app/controllers/hello/authentication/sudo_mode_controller.rb', line 26

def expire
  business = Business::Authentication::SudoModeExpiration.new(current_access)
  business.expire!
  flash[:notice] = business.success_message
  redirect_to '/'
end

#formObject

GET /hello/sudo_mode



7
8
9
# File 'app/controllers/hello/authentication/sudo_mode_controller.rb', line 7

def form
  render_sudo_mode_form
end