authentication-zero 2.12.5 → 2.12.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56295ed54d4a467ec1245634e3ab828d5128c601805bdaff0f232f9cd69ed08e
4
- data.tar.gz: c8789b35631e6f4be5c6ba3f666eaa997f5dcdca2c23ba23fe013b0f55d36e2c
3
+ metadata.gz: 39712c822deb0a2df94156ce44de1cbcd604be043498b56b2139c0dce6d81e51
4
+ data.tar.gz: 3e4704a6d3cc5c1e2da391deee5f9e5f2b4ce43374a555e3535f6ddbdfbfbb3d
5
5
  SHA512:
6
- metadata.gz: 31e6c3963edabe40e298b758d4295ab03f13960aa5dae81089f4f2c3769589c45b56b2a4cd2c7faad373b681b03c5f52a90bb4a55696d64c203c6ae60b860ca0
7
- data.tar.gz: 6cebd96d1801c3d53de594d16d8b9864683acd1b4a176cf6c7bcf6f706e57a8a8865c845ae9faa793070ebff733436bd48bca65f52d21e4dcce660861960fe63
6
+ metadata.gz: b2ca2648b71d9429eab8811922bb44985d158702373908fbd4a58bc40e6f0bd08fc28b4e7e58f4f6ecb6cdb837ffede42ea8aadeb7c0991fc0e85558a7319644
7
+ data.tar.gz: '0897ed09e494352a9429db06982c160b5259578e2dfa0f21cd51e37d0dc57975e847af1e3147af84cf069cf3c4c28e06772581a85480c12686ca27d975a463b6'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (2.12.5)
4
+ authentication-zero (2.12.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.12.5"
2
+ VERSION = "2.12.6"
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_confirmation.deliver_later
11
+ UserMailer.with(user: Current.user).email_verification.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: "verify_#{params[:email]}")
25
+ @user = User.where(email: params[:email]).find_signed!(params[:token], purpose: "email_verification/#{params[:email]}")
26
26
  rescue
27
27
  render json: { error: "That email verification link is invalid" }, status: :bad_request
28
28
  <%- end -%>
@@ -10,7 +10,7 @@ class Identity::PasswordResetsController < ApplicationController
10
10
  if @user = User.find_by(email: params[:email], verified: true)
11
11
  UserMailer.with(user: @user).password_reset.deliver_later
12
12
  else
13
- render json: { error: "You can't reset your password until you verify your email" }, status: :not_found
13
+ render json: { error: "You can't reset your password until you verify your email" }, status: :bad_request
14
14
  end
15
15
  end
16
16
 
@@ -9,13 +9,13 @@ class Identity::EmailVerificationsController < ApplicationController
9
9
  end
10
10
 
11
11
  def create
12
- UserMailer.with(user: Current.user).email_confirmation.deliver_later
12
+ UserMailer.with(user: Current.user).email_verification.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: "verify_#{params[:email]}")
18
+ @user = User.where(email: params[:email]).find_signed!(params[:token], purpose: "email_verification/#{params[:email]}")
19
19
  rescue
20
20
  redirect_to edit_identity_email_path, alert: "That email verification link is invalid"
21
21
  end
@@ -6,12 +6,12 @@ class UserMailer < ApplicationMailer
6
6
  mail to: @user.email, subject: "Reset your password"
7
7
  end
8
8
 
9
- def email_confirmation
9
+ def email_verification
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: "verify_#{@user.email}", expires_in: 2.days)
14
+ @signed_id = @user.signed_id(purpose: "email_verification/#{@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_confirmation.deliver_later
31
+ UserMailer.with(user: self).email_verification.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: "verify_#{@user.email}", expires_in: 20.minutes)
7
- @sid_exp = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 0.minutes)
6
+ @sid = @user.signed_id(purpose: "email_verification/#{@user.email}", expires_in: 20.minutes)
7
+ @sid_exp = @user.signed_id(purpose: "email_verification/#{@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_confirmation, args: { user: @user } do
17
+ assert_enqueued_email_with UserMailer, :email_verification, args: { user: @user } do
18
18
  post identity_email_verification_url, headers: default_headers
19
19
  end
20
20
 
@@ -20,7 +20,7 @@ class Identity::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
20
20
  post identity_password_reset_url, params: { email: "invalid_email@hey.com" }
21
21
  end
22
22
 
23
- assert_response :not_found
23
+ assert_response :bad_request
24
24
  assert_equal "You can't reset your password until you verify your email", response.parsed_body["error"]
25
25
  end
26
26
 
@@ -31,7 +31,7 @@ class Identity::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
31
31
  post identity_password_reset_url, params: { email: @user.email }
32
32
  end
33
33
 
34
- assert_response :not_found
34
+ assert_response :bad_request
35
35
  assert_equal "You can't reset your password until you verify your email", response.parsed_body["error"]
36
36
  end
37
37
 
@@ -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: "verify_#{@user.email}", expires_in: 20.minutes)
7
- @sid_exp = @user.signed_id(purpose: "verify_#{@user.email}", expires_in: 0.minutes)
6
+ @sid = @user.signed_id(purpose: "email_verification/#{@user.email}", expires_in: 20.minutes)
7
+ @sid_exp = @user.signed_id(purpose: "email_verification/#{@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_confirmation, args: { user: @user } do
13
+ assert_enqueued_email_with UserMailer, :email_verification, args: { user: @user } do
14
14
  post identity_email_verification_url
15
15
  end
16
16
 
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.5
4
+ version: 2.12.6
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-23 00:00:00.000000000 Z
11
+ date: 2022-04-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -70,8 +70,8 @@ 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_confirmation.html.erb.tt
74
- - lib/generators/authentication/templates/erb/user_mailer/email_confirmation.text.erb.tt
73
+ - lib/generators/authentication/templates/erb/user_mailer/email_verification.html.erb.tt
74
+ - lib/generators/authentication/templates/erb/user_mailer/email_verification.text.erb.tt
75
75
  - lib/generators/authentication/templates/erb/user_mailer/password_reset.html.erb.tt
76
76
  - lib/generators/authentication/templates/erb/user_mailer/password_reset.text.erb.tt
77
77
  - lib/generators/authentication/templates/mailers/session_mailer.rb.tt