authentication-zero 2.15.4 → 2.15.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 672ec873e54822b2b2326c699dd9a0be3ea0034251c38b34c5ef541be69967b6
4
- data.tar.gz: a4e898e189bb3e20fb2e143378c8a6625d857ff57619592b669de9e076dfc6d1
3
+ metadata.gz: 01c7b52ff1b2e13b2156ce3cbb1be0818ceeec438f81731043a021c108f7857c
4
+ data.tar.gz: e6737c19691028d086f970f7e0d78d9e9554de1a78270a3a4c4e4e1fb560d9f5
5
5
  SHA512:
6
- metadata.gz: '02690154f0a711b3cdeafe89b38d318d01b974e0ac78e5648d26ae8c76e44486b00973100076e17df7bbae1a9e1d01b4190c4242b479f538159a1eb5fd4d6236'
7
- data.tar.gz: a65f3ebcdb0804789e0546db6ca5370056e93d4713bf0576133af58cc2e3dc6eb4005750d3677618121ef8f7ecb44e96a46f2b797a6cdbd23e4675eb89872e45
6
+ metadata.gz: ba47e6108df6c2becd72a35c2d5c88a1c7f40e9342c1cf8dbe5555ad103e39602b955f0aba86930943d0450b07cd59bf1a6d2b3c9717405fe784ecb97835c13d
7
+ data.tar.gz: 429c2c959760ec9b154cd4bc96def21d00db21d7490e01f768608a423b81af66e1a79165220b084a691437f67e404fe14a6f275ded7628bd790096576d293fb2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (2.15.4)
4
+ authentication-zero (2.15.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.15.4"
2
+ VERSION = "2.15.7"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  class UserMailer < ApplicationMailer
2
2
  def password_reset
3
3
  @user = params[:user]
4
- @signed_id = @user.create_password_reset_token.signed_id(expires_in: 20.minutes)
4
+ @signed_id = @user.password_reset_tokens.create.signed_id(expires_in: 20.minutes)
5
5
 
6
6
  mail to: @user.email, subject: "Reset your password"
7
7
  end
@@ -11,7 +11,7 @@ class UserMailer < ApplicationMailer
11
11
  <%- if code_verifiable? -%>
12
12
  @user.verification_code.value = rand.to_s[2..7]
13
13
  <%- else -%>
14
- @signed_id = @user.create_email_verification_token.signed_id(expires_in: 2.days)
14
+ @signed_id = @user.email_verification_tokens.create.signed_id(expires_in: 2.days)
15
15
  <%- end -%>
16
16
 
17
17
  mail to: @user.email, subject: "Verify your email"
@@ -1,7 +1,7 @@
1
1
  class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
3
  create_table :email_verification_tokens do |t|
4
- t.references :user, null: false, foreign_key: false
4
+ t.references :user, null: false, foreign_key: true
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
2
2
  def change
3
3
  create_table :password_reset_tokens do |t|
4
- t.references :user, null: false, foreign_key: false
4
+ t.references :user, null: false, foreign_key: true
5
5
  end
6
6
  end
7
7
  end
@@ -1,8 +1,8 @@
1
1
  class User < ApplicationRecord
2
2
  has_secure_password
3
3
 
4
- has_one :email_verification_token
5
- has_one :password_reset_token
4
+ has_many :email_verification_tokens, dependent: :destroy
5
+ has_many :password_reset_tokens, dependent: :destroy
6
6
 
7
7
  has_many :sessions, dependent: :destroy
8
8
  <%- if options.trackable? -%>
@@ -19,14 +19,14 @@ class Identity::EmailVerificationsControllerTest < ActionDispatch::IntegrationTe
19
19
  end
20
20
 
21
21
  test "should verify email" do
22
- sid = @user.create_email_verification_token.signed_id(expires_in: 2.days)
22
+ sid = @user.email_verification_tokens.create.signed_id(expires_in: 2.days)
23
23
 
24
24
  get edit_identity_email_verification_url, params: { sid: sid }, headers: default_headers
25
25
  assert_response :no_content
26
26
  end
27
27
 
28
28
  test "should not verify email with expired token" do
29
- sid_exp = @user.create_email_verification_token.signed_id(expires_in: 0.minutes)
29
+ sid_exp = @user.email_verification_tokens.create.signed_id(expires_in: 0.minutes)
30
30
 
31
31
  get edit_identity_email_verification_url, params: { sid: sid_exp }, headers: default_headers
32
32
  assert_response :bad_request
@@ -34,14 +34,14 @@ class Identity::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
34
34
  end
35
35
 
36
36
  test "should update password" do
37
- sid = @user.create_password_reset_token.signed_id(expires_in: 20.minutes)
37
+ sid = @user.password_reset_tokens.create.signed_id(expires_in: 20.minutes)
38
38
 
39
39
  patch identity_password_reset_url, params: { sid: sid, password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" }
40
40
  assert_response :success
41
41
  end
42
42
 
43
43
  test "should not update password with expired token" do
44
- sid_exp = @user.create_password_reset_token.signed_id(expires_in: 0.minutes)
44
+ sid_exp = @user.password_reset_tokens.create.signed_id(expires_in: 0.minutes)
45
45
 
46
46
  patch identity_password_reset_url, params: { sid: sid_exp, password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" }
47
47
  assert_response :bad_request
@@ -15,14 +15,14 @@ class Identity::EmailVerificationsControllerTest < ActionDispatch::IntegrationTe
15
15
  end
16
16
 
17
17
  test "should verify email" do
18
- sid = @user.create_email_verification_token.signed_id(expires_in: 2.days)
18
+ sid = @user.email_verification_tokens.create.signed_id(expires_in: 2.days)
19
19
 
20
20
  get edit_identity_email_verification_url(sid: sid, email: @user.email)
21
21
  assert_redirected_to root_url
22
22
  end
23
23
 
24
24
  test "should not verify email with expired token" do
25
- sid_exp = @user.create_email_verification_token.signed_id(expires_in: 0.minutes)
25
+ sid_exp = @user.email_verification_tokens.create.signed_id(expires_in: 0.minutes)
26
26
 
27
27
  get edit_identity_email_verification_url(sid: sid_exp, email: @user.email)
28
28
 
@@ -11,7 +11,7 @@ class Identity::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
11
11
  end
12
12
 
13
13
  test "should get edit" do
14
- sid = @user.create_password_reset_token.signed_id(expires_in: 20.minutes)
14
+ sid = @user.password_reset_tokens.create.signed_id(expires_in: 20.minutes)
15
15
 
16
16
  get edit_identity_password_reset_url(sid: sid)
17
17
  assert_response :success
@@ -46,14 +46,14 @@ class Identity::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
46
46
  end
47
47
 
48
48
  test "should update password" do
49
- sid = @user.create_password_reset_token.signed_id(expires_in: 20.minutes)
49
+ sid = @user.password_reset_tokens.create.signed_id(expires_in: 20.minutes)
50
50
 
51
51
  patch identity_password_reset_url, params: { sid: sid, password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" }
52
52
  assert_redirected_to sign_in_url
53
53
  end
54
54
 
55
55
  test "should not update password with expired token" do
56
- sid_exp = @user.create_password_reset_token.signed_id(expires_in: 0.minutes)
56
+ sid_exp = @user.password_reset_tokens.create.signed_id(expires_in: 0.minutes)
57
57
 
58
58
  patch identity_password_reset_url, params: { sid: @sid_exp, password: "Secret6*4*2*", password_confirmation: "Secret6*4*2*" }
59
59
  assert_redirected_to new_identity_password_reset_url
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.15.4
4
+ version: 2.15.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-11 00:00:00.000000000 Z
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: