You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We aim to provide our users with the functionality of being able to retry sending a verification email if they don't receive it. This way the process of verifying is safer.
For this reason, we have to have an endpoint that the client side can trigger by passing the email or participant object id that will retry sending a verification email. This endpoint can be an extension of the already established verification endpoint /api/v3/hackathon/participants/verify. A suggestion could be /api/v3/hackathon/participants/verify/send-email
How to achieve it:
We should rate limit this process in case someone tries to spam the endpoint and rate limit our resend service (since with the free tier we can only send so many emails within a given time). @cl3vy has already provided a working solution. We firstly need to update the structure of the participant document to:
@dataclass(kw_only=True)classParticipant(Base):
"""A representation of the Participant entity in Mongo. It is also the schema of how the entity should look like in Mongo before it is inserted"""name: stremail: EmailStris_admin: boolemail_verified: bool=field(default=False)
team_id: Optional[SerializableObjectId]
last_sent_email: Optional[datetime] =field(default=None)
Then every time we get a request in this endpoint, we check if enough time has passed since the last email sent.
# Check rate limitifparticipant.last_sent_email:
ifdatetime.now() -participant.last_sent_email<timedelta(seconds=RATE_LIMIT_SECONDS):
LOG.error(f"Rate limit exceeded for participant {participant.id} with email {participant.email}.")
returnErr(EmailRateLimitExceededError())
If the rate limit is not exceeded you proceed with sending the email.
You can get some inspiration from these changes: 600e52d
Prerequisites
The following issues should be closed before starting work with this one:
Brief description:
We aim to provide our users with the functionality of being able to retry sending a verification email if they don't receive it. This way the process of verifying is safer.
For this reason, we have to have an endpoint that the client side can trigger by passing the email or participant object id that will retry sending a verification email. This endpoint can be an extension of the already established verification endpoint
/api/v3/hackathon/participants/verify
. A suggestion could be/api/v3/hackathon/participants/verify/send-email
How to achieve it:
We should rate limit this process in case someone tries to spam the endpoint and rate limit our resend service (since with the free tier we can only send so many emails within a given time). @cl3vy has already provided a working solution. We firstly need to update the structure of the
participant
document to:Then every time we get a request in this endpoint, we check if enough time has passed since the last email sent.
If the rate limit is not exceeded you proceed with sending the email.
You can get some inspiration from these changes: 600e52d
Prerequisites
The following issues should be closed before starting work with this one:
The text was updated successfully, but these errors were encountered: