Skip to content

Commit

Permalink
Add lockable by default
Browse files Browse the repository at this point in the history
  • Loading branch information
lazaronixon committed Oct 8, 2024
1 parent e80519e commit 0909038
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 13 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Since Authentication Zero generates this code into your application instead of b
- Ask password before sensitive data changes, aka: sudo (--sudoable)
- Reset the user password and send reset instructions
- Reset the user password only from verified emails
- Lock mechanism to prevent email bombing (--lockable)
- Rate limiting for your app, 1000 reqs/minute (--ratelimit)
- Send e-mail confirmation when your email has been changed
- Manage multiple sessions & devices
Expand Down
2 changes: 1 addition & 1 deletion lib/authentication_zero/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module AuthenticationZero
VERSION = "4.0.0"
VERSION = "4.0.1"
end
3 changes: 1 addition & 2 deletions lib/generators/authentication/authentication_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ class AuthenticationGenerator < Rails::Generators::Base
class_option :api, type: :boolean, desc: "Generates API authentication"
class_option :pwned, type: :boolean, desc: "Add pwned password validation"
class_option :sudoable, type: :boolean, desc: "Add password request before sensitive data changes"
class_option :lockable, type: :boolean, desc: "Add password reset locking"
class_option :ratelimit, type: :boolean, desc: "Add request rate limiting"
class_option :passwordless, type: :boolean, desc: "Add passwordless sign"
class_option :passwordless, type: :boolean, desc: "Add passwordless sign in"
class_option :omniauthable, type: :boolean, desc: "Add social login support"
class_option :trackable, type: :boolean, desc: "Add activity log support"
class_option :two_factor, type: :boolean, desc: "Add two factor authentication"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
class Identity::PasswordResetsController < ApplicationController
skip_before_action :authenticate

<%- if options.lockable? -%>
rate_limit to: 10, within: 1.hour, only: :create
<%- end -%>

before_action :set_user, only: :update

def edit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
class Identity::PasswordResetsController < ApplicationController
skip_before_action :authenticate

<%- if options.lockable? -%>
rate_limit to: 10, within: 1.hour, only: :create, with: -> { redirect_to root_path, alert: "Try again later" }
<%- end -%>

before_action :set_user, only: %i[ edit update ]

def new
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
class Sessions::PasswordlessesController < ApplicationController
skip_before_action :authenticate

<%- if options.lockable? -%>
rate_limit to: 10, within: 1.hour, only: :create, with: -> { redirect_to root_path, alert: "Try again later" }
<%- end -%>

before_action :set_user, only: :edit

def new
Expand Down

0 comments on commit 0909038

Please sign in to comment.