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

Fix captcha cache control bug #2326

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Fix captcha cache control bug #2326

merged 1 commit into from
Jan 15, 2024

Conversation

SleeplessOne1917
Copy link
Member

Fixes #2279

@@ -71,9 +71,13 @@ export class Signup extends Component<any, State> {

async fetchCaptcha() {
this.setState({ captchaRes: LOADING_REQUEST });
HttpService.client.setHeaders({
Copy link
Member Author

Choose a reason for hiding this comment

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

It would be helpful to add functionality to the JS client to set headers for individual requests. This time it doesn't matter too much: the signup page should only be visible to unauthenticated users, so we don't have to worry about overwriting the authentication header. However, I can see this making things needlessly difficult down the line.

Copy link
Member

Choose a reason for hiding this comment

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

If its just a few times too, it might be useful to just create either a separate client without headers on demand, or in HTTPService. Adding optional function params to every lemmy-js-client call might be overkill.

@dessalines dessalines merged commit 59308bd into main Jan 15, 2024
2 checks passed
@MV-GH
Copy link

MV-GH commented Jan 15, 2024

Shouldn't this be rather done in the backend, that it should never cache this response.

@SleeplessOne1917 SleeplessOne1917 deleted the captcha-refresh branch January 15, 2024 16:19
@MV-GH
Copy link

MV-GH commented Jan 15, 2024

If the response is cached meaning it didn't hit the server at all and thus never set the correct answer. This is probably what caused me to fail the captcha so much. In other words the response should never be cached.

@Nutomic
Copy link
Member

Nutomic commented Jan 16, 2024

Fix in LemmyNet/lemmy#4381, this commit can be reverted.

@dessalines
Copy link
Member

#2335

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.

Captcha refresh doesn't refresh anymore when pressing the refresh button
4 participants