Skip to content

fix: require login actions for magic links#1329

Open
memleakd wants to merge 1 commit into
codeigniter4:developfrom
memleakd:fix/magic-link-login-actions
Open

fix: require login actions for magic links#1329
memleakd wants to merge 1 commit into
codeigniter4:developfrom
memleakd:fix/magic-link-login-actions

Conversation

@memleakd
Copy link
Copy Markdown
Contributor

Description

This fixes a gap in the magic-link login flow.

Password login already respects configured login auth actions, such as Email-based 2FA. Magic-link login, however, could finish immediately after the token was verified. So an app could have 2FA enabled for normal login, but magic-link login would not go through that same action flow.

With this PR, magic-link login now starts the configured login action when one applies to the user. If an action is required, the user is sent to the normal auth-action screen first, and the magic-link login is only treated as complete after that action passes.

The existing magicLogin session value and magicLogin event still work. They are just delayed until the login action is completed, so they continue to mean "the user has finished logging in with a magic link".

I also added a short note to the docs, plus tests for normal and conditional login actions.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

- Start configured login actions during magic-link verification
- Preserve magicLogin notification until pending actions complete
- Cover normal and conditional login-action magic-link flows
- Document that magic-link login finishes after required login actions

Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant