rails_jwt_auth 1.6.0 → 1.6.1

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: bc3044428ce08ed3c1dd2db9c7352f5542b89f0786a34f0e9cc87eb37f149049
4
- data.tar.gz: b7ebbfd09f4dce43e41150d67b4325712fafac78aef5c9d7081963c267e53fcd
3
+ metadata.gz: a366c8d045f041a81ddb16e375a052f19dc011038d408c79dde19c31e6696968
4
+ data.tar.gz: eafb8cf07deb41c01bf719fda8e66b2b5e6d8cc620bdc418dbd8ffa9d6f55ba1
5
5
  SHA512:
6
- metadata.gz: a1470227b38542cc6d11e218d517e8839fa07bc91d4a8368db8cf61e9e72a9de125a4d3f56e6f0b7c08ed94801e5981a9d023590c052dd36d97a5446d14cfc0c
7
- data.tar.gz: 76f0fe0099e7044694ae5612744128861848373692692f4d7627693b6d79b9fb68a89797f1f092904d49dd021bcdd4c8a50a2979fd23a3c0c16bf42aff81820f
6
+ metadata.gz: 3a29adeb02a5e05ad95773eccdedbdeb53649f5e493c23e16a65541ac8191f39532308faed100866ab6c79ded869b6476e99dbac4257f27c27a5dbb920d31f71
7
+ data.tar.gz: 39d19de7185410e1e8ecdcadaa13674a9ef520e3a0f91edeb883dddd43aa1ca3ed72187a810df475f20004f572a39796c27ebe4d815fa3f12791473d4f1696f4
@@ -17,7 +17,7 @@ module RailsJwtAuth
17
17
  end
18
18
 
19
19
  def password_create_params
20
- params.require(:password).permit(:email)
20
+ params.require(:password).permit(RailsJwtAuth.email_field_name)
21
21
  end
22
22
 
23
23
  def password_update_params
@@ -25,7 +25,7 @@ module RailsJwtAuth
25
25
  end
26
26
 
27
27
  def invitation_create_params
28
- params.require(:invitation).permit(:email)
28
+ params.require(:invitation).permit(RailsJwtAuth.email_field_name)
29
29
  end
30
30
 
31
31
  def invitation_update_params
@@ -4,13 +4,17 @@ module RailsJwtAuth
4
4
  include RenderHelper
5
5
 
6
6
  def create
7
- return render_422(email: [{error: :blank}]) if password_create_params[:email].blank?
7
+ email_field = RailsJwtAuth.email_field_name
8
+
9
+ if password_create_params[email_field].blank?
10
+ return render_422(email_field => [{error: :blank}])
11
+ end
8
12
 
9
13
  user = RailsJwtAuth.model.where(
10
- email: password_create_params[:email].to_s.strip.downcase
14
+ email_field => password_create_params[email_field].to_s.strip.downcase
11
15
  ).first
12
16
 
13
- return render_422(email: [{error: :not_found}]) unless user
17
+ return render_422(email_field => [{error: :not_found}]) unless user
14
18
 
15
19
  user.send_reset_password_instructions ? render_204 : render_422(user.errors.details)
16
20
  end
@@ -72,9 +72,15 @@ module RailsJwtAuth
72
72
  self.confirmation_token = nil
73
73
 
74
74
  if unconfirmed_email
75
- self[RailsJwtAuth.email_field_name!] = unconfirmed_email
76
- self.email_confirmation = unconfirmed_email if respond_to?(:email_confirmation)
75
+ email_field = RailsJwtAuth.email_field_name!
76
+
77
+ self[email_field] = unconfirmed_email
77
78
  self.unconfirmed_email = nil
79
+
80
+ # supports email confirmation attr_accessor validation
81
+ if respond_to?("#{email_field}_confirmation")
82
+ self.instance_variable_set("@#{email_field}_confirmation", self[email_field])
83
+ end
78
84
  end
79
85
 
80
86
  save
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '1.6.0'
2
+ VERSION = '1.6.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_jwt_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rjurado
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-20 00:00:00.000000000 Z
11
+ date: 2020-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt