Sha256: 2838a2b513b69d437f6e6ed799b9adfdd8214d826749654bc3c5d50643211fe3

Contents?: true

Size: 644 Bytes

Versions: 8

Compression:

Stored size: 644 Bytes

Contents

class Trestle::Auth::SessionsController < Trestle::ApplicationController
  layout 'trestle/auth'

  skip_before_action :authenticate_user, only: [:new, :create]
  skip_before_action :require_authenticated_user

  def new
  end

  def create
    if authentication_backend.authenticate!
      redirect_to authentication_backend.previous_location || instance_exec(&Trestle.config.auth.redirect_on_login)
    else
      flash[:error] = t("admin.auth.error", default: "Incorrect login details.")
      redirect_to action: :new
    end
  end

  def destroy
    logout!
    redirect_to instance_exec(&Trestle.config.auth.redirect_on_logout)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trestle-auth-0.5.0 app/controllers/trestle/auth/sessions_controller.rb
trestle-auth-0.5.0.pre2 app/controllers/trestle/auth/sessions_controller.rb
trestle-auth-0.5.0.pre app/controllers/trestle/auth/sessions_controller.rb
trestle-auth-0.4.4 app/controllers/trestle/auth/sessions_controller.rb
trestle-auth-0.4.3 app/controllers/trestle/auth/sessions_controller.rb
trestle-auth-0.4.2 app/controllers/trestle/auth/sessions_controller.rb
trestle-auth-0.4.1 app/controllers/trestle/auth/sessions_controller.rb
trestle-auth-0.4.0 app/controllers/trestle/auth/sessions_controller.rb