Skip to content

Add settings for mail_validation to allow for reusable and time-expiring codes #202

@scottp-dpaw

Description

@scottp-dpaw

We have a number of apps deployed with PSA set up in email authentication mode. For the most part it works okay, but since the introduction of single-use code verification the process falls over for a small number of users:

  • User asks for a verification email to log in
  • Verification email is sent to the user with a code
  • Awful security appliance on user's network intercepts the email/the user's session and visits the link first, eating the session cookie
  • Awful security appliance gets a 302 and hands that back to the user
  • User gets told that their token has expired and to try again
  • Repeat

To fix this, we've added two optional settings:

  • EMAIL_VALIDATION_ALLOW_REUSE (bool): validate_email() will not return False for verified codes
  • EMAIL_VALIDATION_EXPIRED_THRESHOLD (int): validate_email() will return False if the code has a timestamp and is more than [int] seconds in the past

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleStale issues (closing soon)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions