Skip to content

Add throttle limit functions. #226

@laurentmuller

Description

@laurentmuller

When the throttle_limit is shorter than the lifetime, we don't have the possibility to tell the user when he can ask for a new request.

The ResetPasswordToken use the expiresAt property for the getExpirationMessageKey and getExpirationMessageData.

We can maybe implement similar function for the throttle_limit:

  • getThrottleMessageKey()
  • getThrottleMessageData()
  • getThrottleAtIntervalInstance()

Say that lifetime is 3600 and throttle_limit is 600. With this 2 new functions, we can use it in twig as follow:

<p>
This link will expire in {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}.
</p>

<p>
You can only request a new password in {{ resetToken.throttleMessageKey|trans(resetToken.throttleMessageData, 'ResetPasswordBundle') }}.
</p>

We can maybe create a property to tell when user can ask for a new request:

public function getThrottleAt(): \DateTimeInterface
{
    // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions