-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fix reCaptcha LoginForm #17218
Fix reCaptcha LoginForm #17218
Conversation
@rjpowers10 can you please test out this PR? |
…dCMS/OrchardCore into ma/fix-recaptcha-on-login
@MikeAlhayek I can't remember all the places a ReCaptcha is shown. Could there be other places with a similar issue, such as user registration? |
@rjpowers10 I don't know if there is an issue elsewhere. Guessing not since this issue came up after the LoginForm was added. For now, we'll fix the known bug and worry about other "if any" when they are reported. Guessing from your last screenshot you are reporting that the bug is indeed fixed |
Yes, LGTM |
faultyRequestCount++; | ||
_memoryCache.Set(ipAddressKey, faultyRequestCount); | ||
|
||
_memoryCache.Set(ipAddressKey, ++faultyRequestCount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using IDistributedCache
here instead, since this will be node-local, as you observed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do this is a separate PR along with my other notes.
@rjpowers10 I made some change to the tag-helper to use shapes instead which allows reusing that shape from multiple places. Can you please give it one more try to make sure everything still works for you as expected? |
|
||
namespace OrchardCore.ReCaptcha.Drivers; | ||
|
||
public sealed class ReCaptchaLoginFormDisplayDriver : DisplayDriver<LoginForm> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want a driver here to be able to extend the LoginForm with other things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sebastienros
No longer needed. We are rendering this using ShapeTableProvider. Look at the ReCaptchaShapeTableProvider class in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, but I think this should be driven by a driver. Or this is not extensible anymore.
What if you want another component extending the login form with another form or validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to fix linked bug, we have to remove it out of the DisplayDriver. LoginForm
is still extensible. But we can't render the recaptcha from there as it screwes the robot counter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If at least there was a way to take placement into account in this provider. Otherwise this is breaking. It seems like the shape from the driver was called "FormReCaptcha"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the driver was returning a shape result using the FormReCaptcha
type. I think you can still use placement to targeting LoginForm_Edit
. Maybe we should specify a differentiator.
Co-authored-by: Sébastien Ros <sebastienros@gmail.com>
Co-authored-by: Sébastien Ros <sebastienros@gmail.com>
@MikeAlhayek I pulled your changes and the login form continues to work correctly. I fail 5 times and the ReCaptcha is shown on the 6th attempt. However, registration is now broken. I wanted to confirm that registration is also counting the attempts correctly but I can't even get that far.
|
@MikeAlhayek by the way Google has test keys for ReCaptcha you could plug in to make this easier to test yourself. |
Thank you for the tip. I am aware and using this to test it myself. But needed you for a second round of testing. As you can see you spotted issues when I did not :)
I fix this issue in all the views, like UserRegistration, UserForgotPassword and UserResetPassword. Please try it out one more time to make sure you don't spot any additional issues. Thank you! |
I'll take another look. |
I pulled the latest.
Another observation (again, not sure if this is due to your changes or if it was like this before). Successfully logging in will call |
This is from before. The threshold used for Please provide thoughts on removing the |
This PR was replaced by #17229 |
Fix #17200