Skip to content

Prevent linkbots from consuming tokens in one time links#4775

Merged
wes-otf merged 5 commits into
mainfrom
feature/prevent-linkbots-consume-tokens
Mar 27, 2026
Merged

Prevent linkbots from consuming tokens in one time links#4775
wes-otf merged 5 commits into
mainfrom
feature/prevent-linkbots-consume-tokens

Conversation

@frjo
Copy link
Copy Markdown
Member

@frjo frjo commented Mar 25, 2026

Fixes #4535

OBS! PASSWORD_RESET_TIMEOUT have a new sane default of 15 minutes. A new timeout setting PASSWORD_ACTIVATION_TIMEOUT was added that also default to 15 minutes.

PASSWORD_RESET_TIMEOUT used to default to 3 days to allow new users some time to activate their account. Organisation that still want the old default for activation mails can set PASSWORD_ACTIVATION_TIMEOUT = 259200.

This is mainly a fix for MS Outlook mail system habit of doing a preview of links in all e-mails. This preview expires the one time links so when a user tries to login or reset their password it does not work.

The solution is to show an extra confirmation screen with a login button, so users need to click one extra time. This solves the MicrosoftPreview issue and should work for any similar issues as well.

During the work I found a number of inconsistencies in various login related templates that I also attempted to fix. That is the reson so many files are changes in this PR.

Test Steps

  • Use the signup and passwordless login and confirm that you by clicking the link in the email come to a confirmation screen. Clicking the button there log you in to the site.

@frjo frjo added Type: Feature This is something new (not an enhancement of an existing thing). Type: Minor Minor change, used in release drafter labels Mar 25, 2026
@frjo frjo requested a review from wes-otf March 25, 2026 14:09
Copy link
Copy Markdown
Contributor

@wes-otf wes-otf left a comment

Choose a reason for hiding this comment

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

Overall this looks and works fantastic! This is the solution we needed - you were also so fast about this!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

super nitpick but should we also add {% block body_class %}bg-base-200{% endblock %} after the title block? I like how that makes the card pop on the confirm template:

{% block body_class %}bg-base-200{% endblock %}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will look at that, we use the same style in many places so I make sure they all look the same.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The background colour was missing from three templates, fixed now. Looks a lot nicer with it in place!

<div class="flex flex-col justify-center items-center min-h-[60vh]">
<section class="w-full max-w-2xl card shadow-xs bg-base-100 md:card-lg">
<div class="items-center card-body">
<span class="flex justify-center items-center mb-4 rounded-full bg-primary/10">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is so slick! I love the shadowy circle behind the icon

@frjo
Copy link
Copy Markdown
Member Author

frjo commented Mar 25, 2026

Been thinking about a solution for weeks and worked on it since last week, so not so fast 😃.

@frjo frjo force-pushed the feature/prevent-linkbots-consume-tokens branch from 7da74b7 to c728fab Compare March 27, 2026 13:40
@wes-otf wes-otf merged commit 3963a7f into main Mar 27, 2026
8 checks passed
@wes-otf
Copy link
Copy Markdown
Contributor

wes-otf commented Mar 27, 2026

great stuff, thanks @frjo !

wes-otf pushed a commit to OpenTechFund/apply-app that referenced this pull request Apr 6, 2026
Fixes HyphaApp#4535

OBS! `PASSWORD_RESET_TIMEOUT` have a new sane default of 15 minutes. A
new timeout setting `PASSWORD_ACTIVATION_TIMEOUT` was added that also
default to 15 minutes.

`PASSWORD_RESET_TIMEOUT` used to default to 3 days to allow new users
some time to activate their account. Organisation that still want the
old default for activation mails can set `PASSWORD_ACTIVATION_TIMEOUT =
259200`.

This is mainly a fix for MS Outlook mail system habit of doing a preview
of links in all e-mails. This preview expires the one time links so when
a user tries to login or reset their password it does not work.

The solution is to show an extra confirmation screen with a login
button, so users need to click one extra time. This solves the
MicrosoftPreview issue and should work for any similar issues as well.

During the work I found a number of inconsistencies in various login
related templates that I also attempted to fix. That is the reson so
many files are changes in this PR.

## Test Steps

- [ ] Use the signup and passwordless login and confirm that you by
clicking the link in the email come to a confirmation screen. Clicking
the button there log you in to the site.
@frjo frjo deleted the feature/prevent-linkbots-consume-tokens branch April 10, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature This is something new (not an enhancement of an existing thing). Type: Minor Minor change, used in release drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workaround for Outlook previewing login links and expire them prematurely

2 participants