module Authentic::ActionHelpers(T)

Overview

Helpers methods for Lucky actions

Defined in:

authentic/action_helpers.cr

Instance Method Summary

Instance Method Detail

def current_user : T | Nil #

Returns the signed in user if signed in, otherwise returns nil

This method is often overridden by different modules/pipes. For example, When sign in is required this method is typically overridden by calling not_nil! since the user will always be returned.

For an example, see the Auth::RequireSignIn module in a newly generated Lucky project.


[View source]
def current_user? : T | Nil #

Return the signed in user if signed in, otherwise returns nil

This method should not be overridden. If you want to require a current user, override the #current_user method (note no ?).


[View source]
abstract def find_current_user(id : String | T::PrimaryKeyType) : T | Nil #

[View source]
def sign_in(authenticatable : T) : Nil #

Signs a user in using the browser session.


[View source]
def sign_out : Nil #

Sign the user out by clearing the session.


[View source]