Sha256: a62002695853f7b27ab36f8ea03d1258a4fd5164f81bce5b6790128dabdb5e95

Contents?: true

Size: 669 Bytes

Versions: 1

Compression:

Stored size: 669 Bytes

Contents

class Auth::AuthenticatedSessionController < ApplicationController
  include RedirectIfAuthenticated

  skip_authenticate only: %i[new create]
  skip_redirect_if_authenticated only: %i[destroy]

  def new
    render inertia: 'Auth/Login', props: {
      canResetPassword: true,
      status: flash[:status]
    }
  end

  def create
    form = Auth::LoginForm.new params.permit(:email, :password, :remember)

    form.authenticate

    return redirect_back_or_to login_path, inertia: { errors: form.error_messages } if Current.auth.user.nil?

    redirect_to dashboard_path
  end

  def destroy
    Current.auth.logout

    reset_session

    redirect_to '/'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kaze-0.8.0 stubs/inertia-common/app/controllers/auth/authenticated_session_controller.rb