Skip to content

Fixing that a captcha is required on external login and registration, renaming IExternalLoginEventHandler to IExternalLoginUserHandler (Lombiq Technologies: GOV-44) #17490

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

Merged
merged 17 commits into from
Feb 17, 2025

Conversation

Piedone
Copy link
Member

@Piedone Piedone commented Feb 17, 2025

Fixes #17422.

Hotfix for 2.1.x: #17489.

@hishamco
Copy link
Member

I think this duplicate for #17489

@Piedone
Copy link
Member Author

Piedone commented Feb 17, 2025

No, that's for to be included in a patch release, this is breaking for 3.0. Also see the description of that PR.

@hishamco
Copy link
Member

It seems this targets the main but why do we need two PRs? I think Git has a way of picking a certain commit and add it into a certain branch

Copy link
Member

@MikeAlhayek MikeAlhayek left a comment

Choose a reason for hiding this comment

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

I don't think I understand the benefit of doing this. We are introducing a breaking change in exchange for interface and class renaming. Why do we have to do this? Can't we just avoid renaming the interfaces and back port this PR into release/2.1 instead?


public LoginFormEventEventHandler(ReCaptchaService reCaptchaService)
public LoginFormEventEventHandler(ReCaptchaService reCaptchaService, SignInManager<IUser> signInManager)
Copy link
Member

Choose a reason for hiding this comment

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

Please span over multiple lines while leaving the first line empty

=> _reCaptchaService.ValidateCaptchaAsync(reportError);
public override async Task RegistrationValidationAsync(Action<string, string> reportError)
{
if (await _signInManager.GetExternalLoginInfoAsync() == null)
Copy link
Member

Choose a reason for hiding this comment

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

It maybe be helpful to add a comment here explaining why not to validate when we're is an external am login.

And I would do if(... is not null)
{
return;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't really see the point of doing an early return when the rest of the method is a single statement, since then it just makes it more verbose. But I changed these.

=> _reCaptchaService.ValidateCaptchaAsync(reportError);
public override async Task LoggingInAsync(string userName, Action<string, string> reportError)
{
if (await _signInManager.GetExternalLoginInfoAsync() == null)
Copy link
Member

Choose a reason for hiding this comment

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

Same as below, I would invert the condition and add a return. Also add a small comment.

@Piedone
Copy link
Member Author

Piedone commented Feb 17, 2025

The rename is because under #17422 (comment) you said you're not satisfied with an event handler generating these values, but I don't insist.

@MikeAlhayek
Copy link
Member

Please backport this PR too once you merge it.

Co-authored-by: Mike Alhayek <[email protected]>
Co-authored-by: Mike Alhayek <[email protected]>
@MikeAlhayek MikeAlhayek merged commit 55c5809 into OrchardCMS:main Feb 17, 2025
6 checks passed
@MikeAlhayek
Copy link
Member

/backport to release/2.1

Copy link
Contributor

Started backporting to release/2.1: https://github.com/OrchardCMS/OrchardCore/actions/runs/13378469725

Copy link
Contributor

@MikeAlhayek backporting to "release/2.1" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fixing variable names
Using index info to reconstruct a base tree...
M	src/OrchardCore.Modules/OrchardCore.Users/Controllers/ExternalAuthenticationsController.cs
Falling back to patching base and 3-way merge...
Auto-merging src/OrchardCore.Modules/OrchardCore.Users/Controllers/ExternalAuthenticationsController.cs
CONFLICT (content): Merge conflict in src/OrchardCore.Modules/OrchardCore.Users/Controllers/ExternalAuthenticationsController.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fixing variable names
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

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.

Recaptcha and Microsoft Entra ID don't mix
3 participants