Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow additional login params, Introduce LogInValidator #3670

Merged
merged 4 commits into from
Nov 7, 2022

Conversation

imorland
Copy link
Member

@imorland imorland commented Nov 6, 2022

Precursor to https://discuss.flarum.org/d/31904-enabling-cloudflare-turnstile-on-login

Changes proposed in this pull request:

  • Extract params into an extendable function so that additional params can be added in LogInModal
  • LogInController runs validation of the supplied params against a new LogInValidator - empty ruleset by default.

Reviewers should focus on:

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)
  • Related core extension PRs: (Remove if irrelevant)

@imorland imorland requested a review from a team as a code owner November 6, 2022 17:42
@imorland imorland added this to the 1.6 milestone Nov 6, 2022
@imorland imorland self-assigned this Nov 6, 2022
Co-authored-by: David Wheatley <hi@davwheat.dev>
Copy link
Member

@SychO9 SychO9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, an event doesn't really seem appropriate to me. I'd rather we create a login validator, empty by default, and extensions can extend the validator instead.

@imorland
Copy link
Member Author

imorland commented Nov 6, 2022

🤔 yeah... That would make more sense, actually. On it...

@davwheat
Copy link
Member

davwheat commented Nov 6, 2022

Why not both?

That would allow for processing of data from a user logging in, and the more traditional approach to validation.

@imorland imorland requested a review from SychO9 November 6, 2022 20:07
@imorland imorland changed the title feat: Allow additional login params, dispatch 'LoggingIn' event feat: Allow additional login params, Introduce LogInValidator Nov 6, 2022
@SychO9
Copy link
Member

SychO9 commented Nov 6, 2022

I don't know, it's not apparent to me what the processing of data could be, and if whatever it is it couldn't be handled using the exsiting extension API (like we did here with the validator), so I prefer dealing with one use case at a time to avoid over-engineering it.

@imorland imorland merged commit 53ab150 into main Nov 7, 2022
@imorland imorland deleted the im/logging-in branch November 7, 2022 13:47
@luceos luceos mentioned this pull request Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants