mohamedyasser27's avatar

Limit the number of password changes

hello guys, i am creating the reset password cycle in my laravel app and i want to limit the number of times it can be done per day, i thought of using Rate limiting, but i want to limit it on the database level for even more control, so i think i should create another table that references the users table by id and has a count and i can run a cron job that resets this table count per day

what do you think is the beset approach?

0 likes
2 replies
Snapey's avatar
Snapey
Best Answer
Level 122

i would add two columns, last_change (date) and change_count (int)

on entering the function, if last change is today and count is already max then quit

if not at max change password and increase count

if different date set to today and set count to 1

No cleanup required

1 like

Please or to participate in this conversation.