rails_jwt_auth 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/rails_jwt_auth/confirmations_controller.rb +8 -1
- data/app/controllers/rails_jwt_auth/passwords_controller.rb +8 -1
- data/app/models/concerns/rails_jwt_auth/confirmable.rb +1 -1
- data/config/locales/en.yml +4 -9
- data/lib/rails_jwt_auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee98dde9d42d0eaeff3e68ae60e35ffcb44987ae
|
4
|
+
data.tar.gz: 051bdc6d42d61d54ded78bfb67fa2212d4e3f80a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40bfb0b9f36c2567ab84f1440a6c4c4bc0e00665cf2ccb916b45157f8491c6fc9ece843dbe6e4d683f09c0d8ad8bb0ac18cabdfc9f948b9d268869eec24c37a8
|
7
|
+
data.tar.gz: cbdb0303345ac024132776bd74f365abdb92ff0f9e2284296cb79834f79a7d49602d186a9e89b66e398dfe129a795c283b7e1c40d725041ae939fe8962628cb3
|
@@ -12,7 +12,10 @@ class RailsJwtAuth::ConfirmationsController < ApplicationController
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def create
|
15
|
-
user = RailsJwtAuth.model.
|
15
|
+
unless (user = RailsJwtAuth.model.where(email: confirmation_params[:email]).first)
|
16
|
+
return render json: create_error_response, status: 422
|
17
|
+
end
|
18
|
+
|
16
19
|
user.send_confirmation_instructions
|
17
20
|
render json: {}, status: 204
|
18
21
|
end
|
@@ -26,4 +29,8 @@ class RailsJwtAuth::ConfirmationsController < ApplicationController
|
|
26
29
|
def show_error_response(user)
|
27
30
|
{errors: user.errors}
|
28
31
|
end
|
32
|
+
|
33
|
+
def create_error_response
|
34
|
+
{errors: {email: [I18n.t('rails_jwt_auth.errors.not_found')]}}
|
35
|
+
end
|
29
36
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
class RailsJwtAuth::PasswordsController < ApplicationController
|
2
2
|
def create
|
3
|
-
user = RailsJwtAuth.model.
|
3
|
+
unless (user = RailsJwtAuth.model.where(email: create_password_params[:email]).first)
|
4
|
+
return render json: create_error_response, status: 422
|
5
|
+
end
|
6
|
+
|
4
7
|
user.send_reset_password_instructions
|
5
8
|
render json: {}, status: 204
|
6
9
|
end
|
@@ -21,6 +24,10 @@ class RailsJwtAuth::PasswordsController < ApplicationController
|
|
21
24
|
params.require(:password).permit(:email)
|
22
25
|
end
|
23
26
|
|
27
|
+
def create_error_response
|
28
|
+
{errors: {email: [I18n.t('rails_jwt_auth.errors.not_found')]}}
|
29
|
+
end
|
30
|
+
|
24
31
|
def update_password_params
|
25
32
|
params.require(:password).permit(:password, :password_confirmation)
|
26
33
|
end
|
@@ -50,7 +50,7 @@ module RailsJwtAuth
|
|
50
50
|
errors.add(:email, I18n.t('rails_jwt_auth.errors.already_confirmed'))
|
51
51
|
elsif confirmation_sent_at &&
|
52
52
|
(confirmation_sent_at < (Time.now - RailsJwtAuth.confirmation_expiration_time))
|
53
|
-
errors.add(:confirmation_token, I18n.t('rails_jwt_auth.errors.
|
53
|
+
errors.add(:confirmation_token, I18n.t('rails_jwt_auth.errors.expired'))
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/config/locales/en.yml
CHANGED
@@ -4,12 +4,7 @@ en:
|
|
4
4
|
confirmation_instructions:
|
5
5
|
subject: "Confirmation instructions"
|
6
6
|
errors:
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
not_found: "not found"
|
12
|
-
not_locked: "was not locked"
|
13
|
-
not_saved:
|
14
|
-
one: "1 error prohibited this %{resource} from being saved:"
|
15
|
-
other: "%{count} errors prohibited this %{resource} from being saved:"
|
7
|
+
already_confirmed: "was already confirmed, please try signing in"
|
8
|
+
expired: "has expired, please request a new one"
|
9
|
+
invalid: "invalid"
|
10
|
+
not_found: "not found"
|
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.3.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-02-
|
11
|
+
date: 2017-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|