rails_jwt_auth 0.16.2 → 0.17.0
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 +4 -4
- data/README.md +1 -0
- data/app/controllers/rails_jwt_auth/confirmations_controller.rb +4 -0
- data/app/controllers/rails_jwt_auth/passwords_controller.rb +4 -0
- data/app/models/concerns/rails_jwt_auth/authenticatable.rb +4 -0
- data/app/validators/email_validator.rb +1 -1
- data/lib/generators/templates/initializer.rb +7 -1
- data/lib/rails_jwt_auth.rb +4 -1
- data/lib/rails_jwt_auth/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1b219bb8ec23bd8bcb9e32a01ac0a2b1ff65ad3
|
4
|
+
data.tar.gz: 661143484c1f4affd78cf5ec8e484b52b8b35d48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b25885a2765a541534f041c5e313781a46076810332d1275494b510d465103fd59716ceddcf41d4eda7b2615e2a29285a82c08eb1282b059cb4d30401e60278b
|
7
|
+
data.tar.gz: b9a62d4b102d13e55fc20ccbe442bfda9deadb5c854b872ec65d1425093068aecc5b3cdc3407ff510eaf8d1f37b92f38ddf115a358c1f9f5a59b6ccf77fb24ec
|
data/README.md
CHANGED
@@ -37,6 +37,7 @@ You can edit configuration options into `config/initializers/auth_token_auth.rb`
|
|
37
37
|
| model_name | 'User' | Authentication model name |
|
38
38
|
| auth_field_name | 'email' | Field used to authenticate user with password |
|
39
39
|
| auth_field_email | true | Validate auth field email format |
|
40
|
+
| email_regex | see config file | Regex used to Validate email format |
|
40
41
|
| jwt_expiration_time | 7.days | Tokens expiration time |
|
41
42
|
| jwt_issuer | 'RailsJwtAuth' | The "iss" (issuer) claim identifies the principal that issued the JWT |
|
42
43
|
| simultaneous_sessions | 2 | Number of simultaneous sessions for an user |
|
@@ -11,6 +11,10 @@ module RailsJwtAuth
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def update
|
14
|
+
if params[:confirmation_token].blank?
|
15
|
+
return render_422(confirmation_token: [I18n.t('rails_jwt_auth.errors.not_found')])
|
16
|
+
end
|
17
|
+
|
14
18
|
user = RailsJwtAuth.model.where(confirmation_token: params[:confirmation_token]).first
|
15
19
|
return render_422(confirmation_token: [I18n.t('rails_jwt_auth.errors.not_found')]) unless user
|
16
20
|
|
@@ -11,6 +11,10 @@ module RailsJwtAuth
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def update
|
14
|
+
if params[:reset_password_token].blank?
|
15
|
+
return render_422(reset_password_token: [I18n.t('rails_jwt_auth.errors.not_found')])
|
16
|
+
end
|
17
|
+
|
14
18
|
user = RailsJwtAuth.model.where(reset_password_token: params[:reset_password_token]).first
|
15
19
|
|
16
20
|
unless user
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class EmailValidator < ActiveModel::EachValidator
|
2
2
|
def validate_each(record, attribute, value)
|
3
|
-
unless value =~
|
3
|
+
unless value =~ RailsJwtAuth.email_regex
|
4
4
|
record.errors[attribute] << (options[:message] || I18n.t('rails_jwt_auth.errors.email.invalid'))
|
5
5
|
end
|
6
6
|
end
|
@@ -8,6 +8,9 @@ RailsJwtAuth.setup do |config|
|
|
8
8
|
# set to true to validate auth_field email format
|
9
9
|
#config.auth_field_email = true
|
10
10
|
|
11
|
+
# regex used to Validate email format
|
12
|
+
#config.email_regex = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
|
13
|
+
|
11
14
|
# expiration time for generated tokens
|
12
15
|
#config.jwt_expiration_time = 7.days
|
13
16
|
|
@@ -15,7 +18,7 @@ RailsJwtAuth.setup do |config|
|
|
15
18
|
#config.jwt_issuer = 'RailsJwtAuth'
|
16
19
|
|
17
20
|
# number of simultaneously sessions for an user
|
18
|
-
#config.simultaneously_sessions =
|
21
|
+
#config.simultaneously_sessions = 2
|
19
22
|
|
20
23
|
# mailer sender
|
21
24
|
#config.mailer_sender = 'initialize-mailer_sender@example.com'
|
@@ -29,6 +32,9 @@ RailsJwtAuth.setup do |config|
|
|
29
32
|
# url used to create email link with reset password token
|
30
33
|
#config.reset_password_url = 'http://frontend.com/reset_password'
|
31
34
|
|
35
|
+
# url used to create email link with set password token
|
36
|
+
#config.set_password_url = 'http://frontend.com/set_password'
|
37
|
+
|
32
38
|
# expiration time for reset password tokens
|
33
39
|
#config.reset_password_expiration_time = 1.day
|
34
40
|
|
data/lib/rails_jwt_auth.rb
CHANGED
@@ -13,6 +13,9 @@ module RailsJwtAuth
|
|
13
13
|
mattr_accessor :auth_field_email
|
14
14
|
@@auth_field_email = true
|
15
15
|
|
16
|
+
mattr_accessor :email_regex
|
17
|
+
@@email_regex = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
|
18
|
+
|
16
19
|
mattr_accessor :jwt_expiration_time
|
17
20
|
@@jwt_expiration_time = 7.days
|
18
21
|
|
@@ -23,7 +26,7 @@ module RailsJwtAuth
|
|
23
26
|
@@simultaneous_sessions = 2
|
24
27
|
|
25
28
|
mattr_accessor :mailer_sender
|
26
|
-
@@mailer_sender =
|
29
|
+
@@mailer_sender = 'initialize-mailer_sender@example.com'
|
27
30
|
|
28
31
|
mattr_accessor :confirmation_url
|
29
32
|
@@confirmation_url = nil
|
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: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rjurado
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -126,8 +126,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.5.
|
129
|
+
rubygems_version: 2.4.5.1
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: Rails jwt authentication.
|
133
133
|
test_files: []
|
134
|
+
has_rdoc:
|