Skip to content

Commit 4e5a13a

Browse files
authored
Merge pull request rails#54442 from excid3/rate-limit-password-reset
Rate limit password resets in auth generator
2 parents ad0105c + 92533b1 commit 4e5a13a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

railties/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
* Rate limit password resets in authentication generator
2+
3+
This helps mitigate abuse from attackers spamming the password reset form.
4+
5+
*Chris Oliver*
6+
17
* Update `rails new --minimal` option
28

39
Extend the `--minimal` flag to exlcude recently added features:

railties/lib/rails/generators/rails/authentication/templates/app/controllers/passwords_controller.rb.tt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
class PasswordsController < ApplicationController
22
allow_unauthenticated_access
33
before_action :set_user_by_token, only: %i[ edit update ]
4+
rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_password_path, alert: "Try again later." }
45

56
def new
67
end

0 commit comments

Comments
 (0)