module Authentic::ActionHelpers(T)

Overview

Helpers methods for Lucky actions

Defined in:

Constant Summary

SIGN_IN_KEY = "user_id"

Instance Method Summary

Instance Method Detail

def current_user : T? #

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.


def current_user? : T? #

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 ?).


abstract def find_current_user(id) : T? #

def sign_in(authenticatable : T) : Void #

Signs a user in using the browser session.


def sign_out : Void #

Sign the user out by clearing the session.