Sha256: 7f400d5e8de84515ff87fefb4f2e3465ba2e75c7efffd61a1800f4a5602f4bff

Contents?: true

Size: 658 Bytes

Versions: 2

Compression:

Stored size: 658 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)

    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

2 entries across 2 versions & 1 rubygems

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