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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9589fdf911fced81b12de566e8f9927bdc12ce9d
4
- data.tar.gz: a4be03afd54584155a7f0d5a99ac818abb0b83cb
3
+ metadata.gz: ee98dde9d42d0eaeff3e68ae60e35ffcb44987ae
4
+ data.tar.gz: 051bdc6d42d61d54ded78bfb67fa2212d4e3f80a
5
5
  SHA512:
6
- metadata.gz: 208a716cd5ca4cb040e4d05d90ddd98135c0911be40ba7745a7e1be595ed86ee99766209d318f42277911506bed667d6c9fef60cd32677cec0a45ee3bd433d7c
7
- data.tar.gz: bc03c6fe5c4209dce482f26c3fe400d6720f2057592bb0c78b944212ea69e6165a4422ca7240cc99b65512323c981a2e1f90a182441879546d14d37e70eb18e6
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.find_by!(email: confirmation_params[:email])
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.find_by!(email: create_password_params[:email])
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.confirmation_expired'))
53
+ errors.add(:confirmation_token, I18n.t('rails_jwt_auth.errors.expired'))
54
54
  end
55
55
  end
56
56
  end
@@ -4,12 +4,7 @@ en:
4
4
  confirmation_instructions:
5
5
  subject: "Confirmation instructions"
6
6
  errors:
7
- messages:
8
- already_confirmed: "was already confirmed, please try signing in"
9
- confirmation_expired: "needs to be confirmed within %{period}, please request a new one"
10
- expired: "has expired, please request a new one"
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"
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '0.2.1'
2
+ VERSION = '0.3.0'
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: 0.2.1
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-25 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails