authentication-zero 2.12.4 → 2.12.5

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.
Files changed (18) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/authentication_zero/version.rb +1 -1
  4. data/lib/generators/authentication/templates/controllers/api/identity/email_verifications_controller.rb.tt +2 -2
  5. data/lib/generators/authentication/templates/controllers/api/identity/password_resets_controller.rb.tt +1 -1
  6. data/lib/generators/authentication/templates/controllers/html/identity/email_verifications_controller.rb.tt +2 -2
  7. data/lib/generators/authentication/templates/controllers/html/identity/password_resets_controller.rb.tt +1 -1
  8. data/lib/generators/authentication/templates/erb/user_mailer/{email_verify_confirmation.html.erb.tt → email_confirmation.html.erb.tt} +0 -0
  9. data/lib/generators/authentication/templates/erb/user_mailer/{email_verify_confirmation.text.erb.tt → email_confirmation.text.erb.tt} +0 -0
  10. data/lib/generators/authentication/templates/erb/user_mailer/{password_reset_provision.html.erb.tt → password_reset.html.erb.tt} +0 -0
  11. data/lib/generators/authentication/templates/erb/user_mailer/{password_reset_provision.text.erb.tt → password_reset.text.erb.tt} +0 -0
  12. data/lib/generators/authentication/templates/mailers/user_mailer.rb.tt +3 -3
  13. data/lib/generators/authentication/templates/models/user.rb.tt +1 -1
  14. data/lib/generators/authentication/templates/test_unit/controllers/api/identity/email_verifications_controller_test.rb.tt +3 -3
  15. data/lib/generators/authentication/templates/test_unit/controllers/api/identity/password_resets_controller_test.rb.tt +1 -1
  16. data/lib/generators/authentication/templates/test_unit/controllers/html/identity/email_verifications_controller_test.rb.tt +3 -3
  17. data/lib/generators/authentication/templates/test_unit/controllers/html/identity/password_resets_controller_test.rb.tt +1 -1
  18. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e153855bfc24252626eb9ccb0381fadf99eda55f66db6d80081de90ea07eede5
4
- data.tar.gz: a0fe741b9b4c073401fea77218fcfb2b7665041a073655bce689d0b84f5ee6ca
3
+ metadata.gz: 56295ed54d4a467ec1245634e3ab828d5128c601805bdaff0f232f9cd69ed08e
4
+ data.tar.gz: c8789b35631e6f4be5c6ba3f666eaa997f5dcdca2c23ba23fe013b0f55d36e2c
5
5
  SHA512:
6
- metadata.gz: 661fa249b995fd6c7e0076a480597c972178a9f05231ff271fc4ecd6e24916f7d0eda5a428d4e4251c2fc0c29de6ea4b8c902f1f3665557bf15e6e2aa5897533
7
- data.tar.gz: 699dc8d96580ba018fd238ff843ceed4d07a0b623f7b3dedd8ec88db2a2fa886025f26e8b5d526a817c0209d80db9a2b0bca0bdcb8c5f3122d10017d45e0b6f0
6
+ metadata.gz: 31e6c3963edabe40e298b758d4295ab03f13960aa5dae81089f4f2c3769589c45b56b2a4cd2c7faad373b681b03c5f52a90bb4a55696d64c203c6ae60b860ca0
7
+ data.tar.gz: 6cebd96d1801c3d53de594d16d8b9864683acd1b4a176cf6c7bcf6f706e57a8a8865c845ae9faa793070ebff733436bd48bca65f52d21e4dcce660861960fe63
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (2.12.4)
4
+ authentication-zero (2.12.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.12.4"
2
+ VERSION = "2.12.5"
3
3
  end
@@ -8,7 +8,7 @@ class Identity::EmailVerificationsController < ApplicationController
8
8
  end
9
9
 
10
10
  def create
11
- UserMailer.with(user: Current.user).email_verify_confirmation.deliver_later
11
+ UserMailer.with(user: Current.user).email_confirmation.deliver_later
12
12
  end
13
13
 
14
14
  private
@@ -22,7 +22,7 @@ class Identity::EmailVerificationsController < ApplicationController
22
22
  render json: { error: "That email verification code is invalid" }, status: :bad_request
23
23
  end
24
24
  <%- else -%>
25
- @user = User.where(email: params[:email]).find_signed!(params[:token], purpose: params[:email])
25
+ @user = User.where(email: params[:email]).find_signed!(params[:token], purpose: "verify_#{params[:email]}")
26
26
  rescue
27
27
  render json: { error: "That email verification link is invalid" }, status: :bad_request
28
28
  <%- end -%>
@@ -8,7 +8,7 @@ class Identity::PasswordResetsController < ApplicationController
8
8
 
9
9
  def create
10
10
  if @user = User.find_by(email: params[:email], verified: true)
11
- UserMailer.with(user: @user).password_reset_provision.deliver_later
11
+ UserMailer.with(user: @user).password_reset.deliver_later
12
12
  else
13
13
  render json: { error: "You can't reset your password until you verify your email" }, status: :not_found
14
14
  end
@@ -9,13 +9,13 @@ class Identity::EmailVerificationsController < ApplicationController
9
9
  end
10
10
 
11
11
  def create
12
- UserMailer.with(user: Current.user).email_verify_confirmation.deliver_later
12
+ UserMailer.with(user: Current.user).email_confirmation.deliver_later
13
13
  redirect_to root_path, notice: "We sent a verification email to your email address"
14
14
  end
15
15
 
16
16
  private
17
17
  def set_user
18
- @user = User.where(email: params[:email]).find_signed!(params[:token], purpose: params[:email])
18
+ @user = User.where(email: params[:email]).find_signed!(params[:token], purpose: "verify_#{params[:email]}")
19
19
  rescue
20
20
  redirect_to edit_identity_email_path, alert: "That email verification link is invalid"
21
21
  end
@@ -14,7 +14,7 @@ class Identity::PasswordResetsController < ApplicationController
14
14
 
15
15
  def create
16
16
  if @user = User.find_by(email: params[:email], verified: true)
17
- UserMailer.with(user: @user).password_reset_provision.deliver_later
17
+ UserMailer.with(user: @user).password_reset.deliver_later
18
18
  redirect_to sign_in_path, notice: "Check your email for reset instructions"
19
19
  else
20
20
  redirect_to new_identity_password_reset_path, alert: "You can't reset your password until you verify your email"
@@ -1,17 +1,17 @@
1
1
  class UserMailer < ApplicationMailer
2
- def password_reset_provision
2
+ def password_reset
3
3
  @user = params[:user]
4
4
  @signed_id = @user.signed_id(purpose: :password_reset, expires_in: 20.minutes)
5
5
 
6
6
  mail to: @user.email, subject: "Reset your password"
7
7
  end
8
8
 
9
- def email_verify_confirmation
9
+ def email_confirmation
10
10
  @user = params[:user]
11
11
  <%- if code_verifiable? -%>
12
12
  @user.verification_code.value = rand.to_s[2..7]
13
13
  <%- else -%>
14
- @signed_id = @user.signed_id(purpose: @user.email, expires_in: 2.days)
14
+ @signed_id = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 2.days)
15
15
  <%- end -%>
16
16
 
17
17
  mail to: @user.email, subject: "Verify your email"
@@ -28,7 +28,7 @@ class User < ApplicationRecord
28
28
  end
29
29
 
30
30
  after_save_commit if: :email_previously_changed? do
31
- UserMailer.with(user: self).email_verify_confirmation.deliver_later
31
+ UserMailer.with(user: self).email_confirmation.deliver_later
32
32
  end
33
33
  <%- if options.trackable? %>
34
34
  after_save_commit if: :email_previously_changed? do
@@ -3,8 +3,8 @@ require "test_helper"
3
3
  class Identity::EmailVerificationsControllerTest < ActionDispatch::IntegrationTest
4
4
  setup do
5
5
  @user, @token = sign_in_as(users(:lazaro_nixon))
6
- @sid = @user.signed_id(purpose: @user.email, expires_in: 20.minutes)
7
- @sid_exp = @user.signed_id(purpose: @user.email, expires_in: 0.minutes)
6
+ @sid = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 20.minutes)
7
+ @sid_exp = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 0.minutes)
8
8
 
9
9
  @user.update! verified: false
10
10
  end
@@ -14,7 +14,7 @@ class Identity::EmailVerificationsControllerTest < ActionDispatch::IntegrationTe
14
14
  end
15
15
 
16
16
  test "should send a verification email" do
17
- assert_enqueued_email_with UserMailer, :email_verify_confirmation, args: { user: @user } do
17
+ assert_enqueued_email_with UserMailer, :email_confirmation, args: { user: @user } do
18
18
  post identity_email_verification_url, headers: default_headers
19
19
  end
20
20
 
@@ -8,7 +8,7 @@ class Identity::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
8
8
  end
9
9
 
10
10
  test "should send a password reset email" do
11
- assert_enqueued_email_with UserMailer, :password_reset_provision, args: { user: @user } do
11
+ assert_enqueued_email_with UserMailer, :password_reset, args: { user: @user } do
12
12
  post identity_password_reset_url, params: { email: @user.email }
13
13
  end
14
14
 
@@ -3,14 +3,14 @@ require "test_helper"
3
3
  class Identity::EmailVerificationsControllerTest < ActionDispatch::IntegrationTest
4
4
  setup do
5
5
  @user = sign_in_as(users(:lazaro_nixon))
6
- @sid = @user.signed_id(purpose: @user.email, expires_in: 20.minutes)
7
- @sid_exp = @user.signed_id(purpose: @user.email, expires_in: 0.minutes)
6
+ @sid = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 20.minutes)
7
+ @sid_exp = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 0.minutes)
8
8
 
9
9
  @user.update! verified: false
10
10
  end
11
11
 
12
12
  test "should send a verification email" do
13
- assert_enqueued_email_with UserMailer, :email_verify_confirmation, args: { user: @user } do
13
+ assert_enqueued_email_with UserMailer, :email_confirmation, args: { user: @user } do
14
14
  post identity_email_verification_url
15
15
  end
16
16
 
@@ -18,7 +18,7 @@ class Identity::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
18
18
  end
19
19
 
20
20
  test "should send a password reset email" do
21
- assert_enqueued_email_with UserMailer, :password_reset_provision, args: { user: @user } do
21
+ assert_enqueued_email_with UserMailer, :password_reset, args: { user: @user } do
22
22
  post identity_password_reset_url, params: { email: @user.email }
23
23
  end
24
24
 
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.12.4
4
+ version: 2.12.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-04-16 00:00:00.000000000 Z
11
+ date: 2022-04-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -70,10 +70,10 @@ files:
70
70
  - lib/generators/authentication/templates/erb/sessions/sudos/new.html.erb.tt
71
71
  - lib/generators/authentication/templates/erb/two_factor_authentication/challenges/new.html.erb.tt
72
72
  - lib/generators/authentication/templates/erb/two_factor_authentication/totps/new.html.erb.tt
73
- - lib/generators/authentication/templates/erb/user_mailer/email_verify_confirmation.html.erb.tt
74
- - lib/generators/authentication/templates/erb/user_mailer/email_verify_confirmation.text.erb.tt
75
- - lib/generators/authentication/templates/erb/user_mailer/password_reset_provision.html.erb.tt
76
- - lib/generators/authentication/templates/erb/user_mailer/password_reset_provision.text.erb.tt
73
+ - lib/generators/authentication/templates/erb/user_mailer/email_confirmation.html.erb.tt
74
+ - lib/generators/authentication/templates/erb/user_mailer/email_confirmation.text.erb.tt
75
+ - lib/generators/authentication/templates/erb/user_mailer/password_reset.html.erb.tt
76
+ - lib/generators/authentication/templates/erb/user_mailer/password_reset.text.erb.tt
77
77
  - lib/generators/authentication/templates/mailers/session_mailer.rb.tt
78
78
  - lib/generators/authentication/templates/mailers/user_mailer.rb.tt
79
79
  - lib/generators/authentication/templates/migrations/create_events_migration.rb.tt