Skip to content

backend: always update `last_verification_sent_at` column after trying to send email

Warren Gifford requested to merge jc/unable-resend-verify-email into main

Created by: unknwon

Our code logic for calculating email sending cooldown consults the value of the user_emails.last_verification_sent_at column, however, if the email didn't get sent in the first place due to any reason, the column is NULL, and resend is impossible. The user would have to first remove and re-add the same email.

Fixes https://github.com/sourcegraph/sourcegraph/issues/36632

Test plan

Manul e2e test and unit test.

  1. Use a bad credential for the site config "email.smtp" (simulate email sending failures)
  2. Add a new email under the user Settings > Emails (any random fake email, shouldn't be verified already by other users)
  3. Refresh the page, click "Resend verification email"
  4. Should see "Last verification email sent too recently" instead of "user email not found [...]"

Merge request reports

Loading