diff --git a/docs/references/authentication/auth_actions.md b/docs/references/authentication/auth_actions.md index 9f6379c17..a1f8f5cb1 100644 --- a/docs/references/authentication/auth_actions.md +++ b/docs/references/authentication/auth_actions.md @@ -57,10 +57,12 @@ public $views = [ ## Defining New Actions While the provided email-based activation and 2FA will work for many sites, others will have different -needs, like using SMS to verify or something completely different. Actions have only one requirement: -they must implement `CodeIgniter\Shield\Authentication\Actions\ActionInterface`. +needs, like using SMS to verify or something completely different. Custom actions must adhere to the following requirements: -The interface defines three methods for `ActionController`: +1. The class name for a "register" action must end with the suffix `Activator` (e.g., `SMSActivator`) to ensure consistency. +2. All custom actions must implement the `CodeIgniter\Shield\Authentication\Actions\ActionInterface`. + +The `ActionInterface` defines three required methods that must be implemented to ensure the action integrates properly with the `ActionController`. **show()** should display the initial page the user lands on immediately after the authentication task, like login. It will typically display instructions to the user and provide an action to take, like @@ -76,4 +78,4 @@ and provides feedback. In the `Email2FA` class, it verifies the code against wha database and either sends them back to the previous form to try again or redirects the user to the page that a `login` task would have redirected them to anyway. -All methods should return either a `Response` or a view string (e.g. using the `view()` function). +All methods should return either a `Response` or a view string (e.g. using the `view()` function). \ No newline at end of file diff --git a/src/Config/Auth.php b/src/Config/Auth.php index c0f84a4b9..b4f007b2c 100644 --- a/src/Config/Auth.php +++ b/src/Config/Auth.php @@ -95,6 +95,11 @@ class Auth extends BaseConfig * - register: \CodeIgniter\Shield\Authentication\Actions\EmailActivator::class * - login: \CodeIgniter\Shield\Authentication\Actions\Email2FA::class * + * Custom Actions and Requirements: + * + * - All actions must implement \CodeIgniter\Shield\Authentication\Actions\ActionInterface. + * - Custom actions for "register" must have a class name that ends with the suffix "Activator" (e.g., `CustomSmsActivator`) ensure proper functionality. + * * @var array|null> */ public array $actions = [