Sha256: 24e804d01108c16827770427827fbe6e7a6d21ff9f82ca01546198bce5c7769d

Contents?: true

Size: 638 Bytes

Versions: 2

Compression:

Stored size: 638 Bytes

Contents

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

  skip_before_action :require_authenticated_user

  def new
  end

  def create
    if user = Trestle.config.auth.authenticate(params)
      login!(user)
      remember_me! if params[:remember_me] == "1"
      redirect_to 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

2 entries across 2 versions & 1 rubygems

Version Path
trestle-auth-0.3.0 app/controllers/trestle/auth/sessions_controller.rb
trestle-auth-0.2.5 app/controllers/trestle/auth/sessions_controller.rb