Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add throttle limit functions. #226

Open
laurentmuller opened this issue Jun 13, 2022 · 0 comments
Open

Add throttle limit functions. #226

laurentmuller opened this issue Jun 13, 2022 · 0 comments

Comments

@laurentmuller
Copy link

laurentmuller commented Jun 13, 2022

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
{
    // ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant