Class: Omnitrack::Path::SessionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/omnitrack/path/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
# File 'app/controllers/omnitrack/path/sessions_controller.rb', line 12

def create
  if valid_credentials?
    session[:omnitrack_admin_authenticated] = true
    redirect_to visit_events_path(locale: I18n.locale), notice: t("omnitrack.auth.login_success")
  else
    flash.now[:alert] = t("omnitrack.auth.login_failed")
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



22
23
24
25
# File 'app/controllers/omnitrack/path/sessions_controller.rb', line 22

def destroy
  session.delete(:omnitrack_admin_authenticated)
  redirect_to (locale: I18n.locale), notice: t("omnitrack.auth.logout_success")
end

#newObject



10
# File 'app/controllers/omnitrack/path/sessions_controller.rb', line 10

def new; end