twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Fix Captcha when entering a wrong password

Open FelixMalfait opened this issue 1 year ago • 1 comments

We recently implemented captchas to improve the app's security.

But one think we didn't anticipate is the renewal of captcha in case you type a wrong password. In that case, when frontend receive a negative response, it should ask for a new token. Currently it still sends the old token which has already been used once for the first password attempt and which is therefore invalidated already.

FelixMalfait avatar May 21 '24 21:05 FelixMalfait

Disclaimer: This comment was automatically generated with AI. It can give some useful hints as to where to look for, but sometimes it can also give very inaccurate answers so takes this with a pinch of salt :).

To fix the captcha renewal issue when entering a wrong password, follow these steps:

  1. In useAuth and useSignInUp hooks, modify the logic to handle negative responses due to wrong passwords.
  2. Use the useRequestFreshCaptchaToken hook to request a new captcha token upon receiving a negative response.
  3. Update the authentication retry logic to use the new captcha token.

Ensure these changes are implemented in the relevant files where the hooks are defined and used.

References

greptile-apps[bot] avatar May 21 '24 21:05 greptile-apps[bot]

Hi @FelixMalfait I'd love to work on this. Can I take this?

nganphan123 avatar May 23 '24 23:05 nganphan123

Sure thanks @nganphan123!

FelixMalfait avatar May 24 '24 13:05 FelixMalfait

Please keep us updated as it's something that ideally shouldn't stay open for too long. Thanks a lot!

FelixMalfait avatar May 24 '24 13:05 FelixMalfait

Hey @FelixMalfait, I found the issue and was able to resolve it. I see that the issue is currently assigned to @nganphan123. If it is an immediate concern, I would like to create a PR for this. Could you please assign this issue to me if possible?

piyushyadav1617 avatar May 27 '24 12:05 piyushyadav1617

Thanks @piyushyadav1617 ; let the best PR win then 😁

🙏

FelixMalfait avatar May 27 '24 12:05 FelixMalfait

Hi @FelixMalfait , I had my solution ready. But, I stuck at rebuilding the image to test code in deployment. Since @piyushyadav1617 created a PR, I'll leave it to them then. I'll take a look at another issue. Thanks for assigning this to me before.

nganphan123 avatar May 27 '24 16:05 nganphan123

@nganphan123 no problem! Thanks for taking a shot at it!

FelixMalfait avatar May 27 '24 18:05 FelixMalfait