@@ -56,7 +56,9 @@ class Auth extends BaseConfig
5656 'action_email_activate_email ' => '\CodeIgniter\Shield\Views\Email\email_activate_email ' ,
5757 'magic-link-login ' => '\CodeIgniter\Shield\Views\magic_link_form ' ,
5858 'magic-link-message ' => '\CodeIgniter\Shield\Views\magic_link_message ' ,
59+ 'magic-link-code ' => '\CodeIgniter\Shield\Views\magic_link_code ' , // (new)
5960 'magic-link-email ' => '\CodeIgniter\Shield\Views\Email\magic_link_email ' ,
61+ 'magic-link-email-code ' => '\CodeIgniter\Shield\Views\Email\magic_link_email_code ' , // (new)
6062 ];
6163
6264 /**
@@ -173,22 +175,45 @@ class Auth extends BaseConfig
173175
174176 /**
175177 * --------------------------------------------------------------------
176- * Allow Magic Link Logins
178+ * Allow Magic Login
177179 * --------------------------------------------------------------------
178- * If true, will allow the use of "magic links" sent via the email
179- * as a way to log a user in without the need for a password.
180- * By default, this is used in place of a password reset flow, but
181- * could be modified as the only method of login once an account
182- * has been set up.
180+ * If true, users may log in using a secure, one-time credential sent by email.
181+ * 5 delivery modes are supported: clickable login **link**, or a one-time **code** for manual entry.
183182 */
184183 public bool $ allowMagicLinkLogins = true ;
185184
186185 /**
187186 * --------------------------------------------------------------------
188- * Magic Link Lifetime
187+ * Magic Login Mode
189188 * --------------------------------------------------------------------
190- * Specifies the amount of time, in seconds, that a magic link is valid.
191- * You can use Time Constants or any desired number.
189+ * Determines how magic login works:
190+ *
191+ * - 'clickable' => send an email with a clickable link (default)
192+ * - '<length>-numeric' => send a numeric code with specified length
193+ * - '<length>-alpha' => send an alphabetic code with specified length
194+ * - '<length>-alnum' => send an alphanumeric code with specified length
195+ * - '<length>-oneof' => send a code of specified length; system chooses
196+ * automatically one of: numeric, alpha, or alnum
197+ *
198+ * Examples:
199+ * 'clickable'
200+ * '6-numeric' // 6-digit numeric code
201+ * '8-alpha' // 8-letter alphabetic code
202+ * '7-alnum' // 7-character alphanumeric code
203+ * '6-oneof' // 6-character code, type chosen automatically
204+ */
205+ public string $ magicLoginMode = 'clickable ' ;
206+
207+ /**
208+ * --------------------------------------------------------------------
209+ * Magic Login Lifetime
210+ * --------------------------------------------------------------------
211+ * Time in seconds that a magic login credential remains valid.
212+ * Applies to both **clickable login links** and **one-time codes**.
213+ *
214+ * When using one-time code mode, it is strongly recommended to set
215+ * the lifetime to only a few minutes (e.g., 120-300 seconds) to reduce
216+ * the risk of guessing or brute-force attempts.
192217 */
193218 public int $ magicLinkLifetime = HOUR ;
194219
0 commit comments