authentication-zero 2.3.2 → 2.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/authentication_zero/version.rb +1 -1
- data/lib/generators/authentication/authentication_generator.rb +2 -2
- data/lib/generators/authentication/templates/erb/identity_mailer/password_reset_provision.html.erb.tt +1 -1
- data/lib/generators/authentication/templates/erb/identity_mailer/password_reset_provision.text.erb.tt +1 -1
- data/lib/generators/authentication/templates/mailers/identity_mailer.rb.tt +2 -2
- data/lib/generators/authentication/templates/migrations/create_sessions_migration.rb.tt +3 -2
- data/lib/generators/authentication/templates/migrations/create_table_migration.rb.tt +2 -2
- data/lib/generators/authentication/templates/test_unit/controllers/api/email_verifications_controller_test.rb.tt +1 -1
- data/lib/generators/authentication/templates/test_unit/controllers/api/emails_controller_test.rb.tt +1 -1
- data/lib/generators/authentication/templates/test_unit/controllers/api/passwords_controller_test.rb.tt +1 -1
- data/lib/generators/authentication/templates/test_unit/controllers/api/registrations_controller_test.rb.tt +1 -1
- data/lib/generators/authentication/templates/test_unit/controllers/api/sessions_controller_test.rb.tt +3 -3
- data/lib/generators/authentication/templates/test_unit/controllers/api/sudos_controller_test.rb.tt +1 -1
- data/lib/generators/authentication/templates/test_unit/controllers/html/email_verifications_controller_test.rb.tt +1 -1
- data/lib/generators/authentication/templates/test_unit/controllers/html/emails_controller_test.rb.tt +1 -1
- data/lib/generators/authentication/templates/test_unit/controllers/html/passwords_controller_test.rb.tt +1 -1
- data/lib/generators/authentication/templates/test_unit/controllers/html/registrations_controller_test.rb.tt +2 -2
- data/lib/generators/authentication/templates/test_unit/controllers/html/sessions_controller_test.rb.tt +3 -3
- data/lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt +1 -1
- 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: bdd056761c0aff038c46100fcbf3565da08adf2d020e250fddee0d8cc3ee27c4
|
4
|
+
data.tar.gz: 17effffa54f3a3d8dd017ac98804935a92e7bd24a540516ba2f0a7880326280a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7a1825d9930a6ca5f61f04076f9f859f75c6d8a496a4cb79abcdb7b46879de13dfc4e92e6db851413ce531b069fcae5c1981529bb6d8706705597fdeb7a040d
|
7
|
+
data.tar.gz: ee57e00000cd2cebd8b2f662392ac7324b24074fb79b47c9917e80d413946fecafa3fbd6b6b867bedf94480725698b4d1ec78c1606610e3373463cbfeba9b509
|
data/Gemfile.lock
CHANGED
@@ -55,7 +55,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def require_sudo
|
58
|
-
if
|
58
|
+
if Current.session.sudo_at < 30.minutes.ago
|
59
59
|
render json: { error: "Enter your password to continue" }, status: :forbidden
|
60
60
|
end
|
61
61
|
end
|
@@ -73,7 +73,7 @@ class AuthenticationGenerator < Rails::Generators::NamedBase
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def require_sudo
|
76
|
-
if
|
76
|
+
if Current.session.sudo_at < 30.minutes.ago
|
77
77
|
redirect_to new_sudo_path(proceed_to_url: request.url)
|
78
78
|
end
|
79
79
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<p>Hey there,</p>
|
2
2
|
|
3
|
-
<p>Can't remember your password for <strong><%%=
|
3
|
+
<p>Can't remember your password for <strong><%%= @<%= singular_table_name %>.email %></strong>? That's OK, it happens. Just hit the link below to set a new one.</p>
|
4
4
|
|
5
5
|
<p><%%= link_to "Reset my password", edit_password_reset_url(token: @signed_id) %></p>
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Hey there,
|
2
2
|
|
3
|
-
Can't remember your password for <%%=
|
3
|
+
Can't remember your password for <%%= @<%= singular_table_name %>.email %>? That's OK, it happens. Just hit the link below to set a new one.
|
4
4
|
|
5
5
|
[Reset my password]<%%= edit_password_reset_url(token: @signed_id) %>
|
6
6
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
class IdentityMailer < ApplicationMailer
|
2
2
|
def password_reset_provision
|
3
3
|
@<%= singular_table_name %> = params[:<%= singular_table_name %>]
|
4
|
-
@signed_id =
|
4
|
+
@signed_id = @<%= singular_table_name %>.signed_id(purpose: :password_reset, expires_in: 20.minutes)
|
5
5
|
|
6
6
|
mail to: @<%= singular_table_name %>.email, subject: "Reset your password"
|
7
7
|
end
|
8
8
|
|
9
9
|
def email_verify_confirmation
|
10
10
|
@<%= singular_table_name %> = params[:<%= singular_table_name %>]
|
11
|
-
@signed_id =
|
11
|
+
@signed_id = @<%= singular_table_name %>.signed_id(purpose: @<%= singular_table_name %>.email, expires_in: 3.days)
|
12
12
|
|
13
13
|
mail to: @<%= singular_table_name %>.email, subject: "Verify your email"
|
14
14
|
end
|
@@ -2,8 +2,9 @@ class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Mi
|
|
2
2
|
def change
|
3
3
|
create_table :sessions do |t|
|
4
4
|
t.references :<%= singular_table_name %>, null: false, foreign_key: true
|
5
|
-
|
6
|
-
t.string :
|
5
|
+
|
6
|
+
t.string :user_agent, null: false
|
7
|
+
t.string :ip_address, null: false
|
7
8
|
|
8
9
|
t.datetime :sudo_at, null: false
|
9
10
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
2
2
|
def change
|
3
3
|
create_table :<%= table_name %> do |t|
|
4
|
-
t.string :email,
|
4
|
+
t.string :email, null: false
|
5
5
|
t.string :password_digest, null: false
|
6
6
|
|
7
|
-
t.boolean :verified, default: false
|
7
|
+
t.boolean :verified, null: false, default: false
|
8
8
|
|
9
9
|
t.timestamps
|
10
10
|
end
|
@@ -39,6 +39,6 @@ class EmailVerificationsControllerTest < ActionDispatch::IntegrationTest
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def sign_in_as(<%= singular_table_name %>)
|
42
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
42
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
43
43
|
end
|
44
44
|
end
|
data/lib/generators/authentication/templates/test_unit/controllers/api/emails_controller_test.rb.tt
CHANGED
@@ -20,6 +20,6 @@ class EmailsControllerTest < ActionDispatch::IntegrationTest
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def sign_in_as(<%= singular_table_name %>)
|
23
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
23
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
24
24
|
end
|
25
25
|
end
|
@@ -18,6 +18,6 @@ class PasswordsControllerTest < ActionDispatch::IntegrationTest
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def sign_in_as(<%= singular_table_name %>)
|
21
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
21
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
22
22
|
end
|
23
23
|
end
|
@@ -20,6 +20,6 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTest
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def sign_in_as(<%= singular_table_name %>)
|
23
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
23
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
24
24
|
end
|
25
25
|
end
|
@@ -16,14 +16,14 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
16
16
|
end
|
17
17
|
|
18
18
|
test "should sign in" do
|
19
|
-
post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "Secret123456" }
|
19
|
+
post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }
|
20
20
|
|
21
21
|
assert_enqueued_email_with SessionMailer, :signed_in_notification, args: { session: @<%= singular_table_name %>.sessions.last }
|
22
22
|
assert_response :created
|
23
23
|
end
|
24
24
|
|
25
25
|
test "should not sign in with wrong credentials" do
|
26
|
-
post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "SecretWrong123" }
|
26
|
+
post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "SecretWrong123" }, headers: { "User-Agent" => "App iOS" }
|
27
27
|
assert_response :unauthorized
|
28
28
|
end
|
29
29
|
|
@@ -33,6 +33,6 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def sign_in_as(<%= singular_table_name %>)
|
36
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
36
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
37
37
|
end
|
38
38
|
end
|
data/lib/generators/authentication/templates/test_unit/controllers/api/sudos_controller_test.rb.tt
CHANGED
@@ -19,6 +19,6 @@ class SudosControllerTest < ActionDispatch::IntegrationTest
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def sign_in_as(<%= singular_table_name %>)
|
22
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
22
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "App iOS" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
23
23
|
end
|
24
24
|
end
|
@@ -39,6 +39,6 @@ class EmailVerificationsControllerTest < ActionDispatch::IntegrationTest
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def sign_in_as(<%= singular_table_name %>)
|
42
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); <%= singular_table_name %>
|
42
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "Firefox" }); <%= singular_table_name %>
|
43
43
|
end
|
44
44
|
end
|
data/lib/generators/authentication/templates/test_unit/controllers/html/emails_controller_test.rb.tt
CHANGED
@@ -30,6 +30,6 @@ class EmailsControllerTest < ActionDispatch::IntegrationTest
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def sign_in_as(<%= singular_table_name %>)
|
33
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); <%= singular_table_name %>
|
33
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "Firefox" }); <%= singular_table_name %>
|
34
34
|
end
|
35
35
|
end
|
@@ -23,6 +23,6 @@ class PasswordsControllerTest < ActionDispatch::IntegrationTest
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def sign_in_as(<%= singular_table_name %>)
|
26
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); <%= singular_table_name %>
|
26
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "Firefox" }); <%= singular_table_name %>
|
27
27
|
end
|
28
28
|
end
|
@@ -8,7 +8,7 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTest
|
|
8
8
|
|
9
9
|
test "should sign up" do
|
10
10
|
assert_difference("<%= class_name %>.count") do
|
11
|
-
post sign_up_url, params: { <%= singular_table_name %>: { email: "lazaronixon@hey.com", password: "Secret123456", password_confirmation: "Secret123456" } }
|
11
|
+
post sign_up_url, params: { <%= singular_table_name %>: { email: "lazaronixon@hey.com", password: "Secret123456", password_confirmation: "Secret123456" } }, headers: { "User-Agent" => "Firefox" }
|
12
12
|
end
|
13
13
|
|
14
14
|
assert_redirected_to root_url
|
@@ -25,6 +25,6 @@ class RegistrationsControllerTest < ActionDispatch::IntegrationTest
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def sign_in_as(<%= singular_table_name %>)
|
28
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); <%= singular_table_name %>
|
28
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "Firefox" }); <%= singular_table_name %>
|
29
29
|
end
|
30
30
|
end
|
@@ -18,7 +18,7 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
18
18
|
end
|
19
19
|
|
20
20
|
test "should sign in" do
|
21
|
-
post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "Secret123456" }
|
21
|
+
post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "Firefox" }
|
22
22
|
assert_enqueued_email_with SessionMailer, :signed_in_notification, args: { session: @<%= singular_table_name %>.sessions.last }
|
23
23
|
|
24
24
|
assert_redirected_to root_url
|
@@ -28,7 +28,7 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
28
28
|
end
|
29
29
|
|
30
30
|
test "should not sign in with wrong credentials" do
|
31
|
-
post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "SecretWrong123" }
|
31
|
+
post sign_in_url, params: { email: @<%= singular_table_name %>.email, password: "SecretWrong123" }, headers: { "User-Agent" => "Firefox" }
|
32
32
|
assert_redirected_to sign_in_url(email_hint: @<%= singular_table_name %>.email)
|
33
33
|
assert_equal "That email or password is incorrect", flash[:alert]
|
34
34
|
|
@@ -47,6 +47,6 @@ class SessionsControllerTest < ActionDispatch::IntegrationTest
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def sign_in_as(<%= singular_table_name %>)
|
50
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); <%= singular_table_name %>
|
50
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "Firefox" }); <%= singular_table_name %>
|
51
51
|
end
|
52
52
|
end
|
data/lib/generators/authentication/templates/test_unit/controllers/html/sudos_controller_test.rb.tt
CHANGED
@@ -21,6 +21,6 @@ class SudosControllerTest < ActionDispatch::IntegrationTest
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def sign_in_as(<%= singular_table_name %>)
|
24
|
-
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
24
|
+
post(sign_in_url, params: { email: <%= singular_table_name %>.email, password: "Secret123456" }, headers: { "User-Agent" => "Firefox" }); [<%= singular_table_name %>, response.headers["X-Session-Token"]]
|
25
25
|
end
|
26
26
|
end
|
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.3.
|
4
|
+
version: 2.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|