authentication-zero 2.13.0 → 2.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/authentication_zero/version.rb +1 -1
- data/lib/generators/authentication/templates/controllers/api/application_controller.rb.tt +5 -7
- data/lib/generators/authentication/templates/controllers/api/identity/password_resets_controller.rb.tt +1 -3
- data/lib/generators/authentication/templates/controllers/html/application_controller.rb.tt +5 -7
- data/lib/generators/authentication/templates/controllers/html/identity/password_resets_controller.rb.tt +1 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a0e9d758b6d4e0b0c40fbda4a80145e842d11a5cf0b4ec06491bcef39eeae7d
|
4
|
+
data.tar.gz: 5701d90d2ca54430f67984367d2e0fd26e2fbe137a4d2d1e3261173c62072724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fcdd24221c895d34988aa6be949a9dd5ba7be283df6e48acb0431bad502c6dd8212617e766d7f547c90135ea19f4956d97369621efb5409c6907afe3d7ab65c
|
7
|
+
data.tar.gz: 93308abcdfa186d607fec5b920bae4e87c1a1f92638b74d012a7d6e3e7914339efb9c8bdb9e41e7ac36531ef082535a3933d5b7a0ebcd02ae0c56f28cb926d18
|
data/Gemfile.lock
CHANGED
@@ -11,14 +11,12 @@ class ApplicationController < ActionController::API
|
|
11
11
|
end
|
12
12
|
<%- end -%>
|
13
13
|
<%- if options.lockable? %>
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
counter.increment
|
14
|
+
def require_lock(wait: 1.hour, attempts: 10)
|
15
|
+
counter = Kredis.counter("require_lock:#{request.remote_ip}:#{params[:controller]}:#{params[:action]}", expires_in: wait)
|
16
|
+
counter.increment
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
end
|
18
|
+
if counter.value > attempts
|
19
|
+
render json: { error: "You've exceeded the maximum number of attempts" }, status: :too_many_requests
|
22
20
|
end
|
23
21
|
end
|
24
22
|
<%- end -%>
|
@@ -3,9 +3,7 @@ class Identity::PasswordResetsController < ApplicationController
|
|
3
3
|
|
4
4
|
before_action :set_user, only: :update
|
5
5
|
<%- if options.lockable? %>
|
6
|
-
|
7
|
-
render json: { error: "You've exceeded the maximum number of attempts" }, status: :too_many_requests
|
8
|
-
end
|
6
|
+
before_action :require_lock, only: :create
|
9
7
|
<%- end -%>
|
10
8
|
|
11
9
|
def create
|
@@ -9,14 +9,12 @@ class ApplicationController < ActionController::Base
|
|
9
9
|
end
|
10
10
|
<%- end -%>
|
11
11
|
<%- if options.lockable? %>
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
counter.increment
|
12
|
+
def require_lock(wait: 1.hour, attempts: 10)
|
13
|
+
counter = Kredis.counter("require_lock:#{request.remote_ip}:#{params[:controller]}:#{params[:action]}", expires_in: wait)
|
14
|
+
counter.increment
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
end
|
16
|
+
if counter.value > attempts
|
17
|
+
redirect_to new_identity_password_reset_path, alert: "You've exceeded the maximum number of attempts"
|
20
18
|
end
|
21
19
|
end
|
22
20
|
<%- end -%>
|
@@ -3,9 +3,7 @@ class Identity::PasswordResetsController < ApplicationController
|
|
3
3
|
|
4
4
|
before_action :set_user, only: %i[ edit update ]
|
5
5
|
<%- if options.lockable? %>
|
6
|
-
|
7
|
-
redirect_to new_identity_password_reset_path, alert: "You've exceeded the maximum number of attempts"
|
8
|
-
end
|
6
|
+
before_action :require_lock, only: :create
|
9
7
|
<%- end -%>
|
10
8
|
|
11
9
|
def new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authentication-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|