rails_jwt_auth 1.5.0 → 1.6.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
  SHA256:
3
- metadata.gz: 2c14c4018d6e871d503f3573886bdc7822a620859aef7b32f0a719a2252b5aa8
4
- data.tar.gz: 4d4e2c16de9787f6c7b940274a3583e112b81cd438623528e0b4cdbc5840b6a5
3
+ metadata.gz: bc3044428ce08ed3c1dd2db9c7352f5542b89f0786a34f0e9cc87eb37f149049
4
+ data.tar.gz: b7ebbfd09f4dce43e41150d67b4325712fafac78aef5c9d7081963c267e53fcd
5
5
  SHA512:
6
- metadata.gz: 6c4caceaa1fdcb313994525a8d734df570202beccd88f9f76131e5d5ba46c4c551a87ac3091261e92feb46339e6a52b3fe407c4768b62f6c834508b1193713dc
7
- data.tar.gz: 427687273a0d51fc837cac6ed841363d707ef87790b1a0d52283ca33bc9a1484e16ae1c5c4691b3649687b1cd2ce9e3a83827aa61afe1757a589b416f2b1d05b
6
+ metadata.gz: a1470227b38542cc6d11e218d517e8839fa07bc91d4a8368db8cf61e9e72a9de125a4d3f56e6f0b7c08ed94801e5981a9d023590c052dd36d97a5446d14cfc0c
7
+ data.tar.gz: 76f0fe0099e7044694ae5612744128861848373692692f4d7627693b6d79b9fb68a89797f1f092904d49dd021bcdd4c8a50a2979fd23a3c0c16bf42aff81820f
data/README.md CHANGED
@@ -197,6 +197,21 @@ end
197
197
 
198
198
  ## Default Controllers API
199
199
 
200
+ | Prefix | Verb | URI Pattern | Controller#Action |
201
+ | ------------ | ------ | ---------------------------- | ----------------------------------- |
202
+ | session | DELETE | /session(.:format) | rails_jwt_auth/sessions#destroy |
203
+ | | POST | /session(.:format) | rails_jwt_auth/sessions#create |
204
+ | registration | POST | /registration(.:format) | rails_jwt_auth/registrations#create |
205
+ |confirmations | POST | /confirmations(.:format) | rails_jwt_auth/confirmations#create |
206
+ | confirmation | PATCH | /confirmations/:id(.:format) | rails_jwt_auth/confirmations#update |
207
+ | | PUT | /confirmations/:id(.:format) | rails_jwt_auth/confirmations#update |
208
+ | passwords | POST | /passwords(.:format) | rails_jwt_auth/passwords#create |
209
+ | password | PATCH | /passwords/:id(.:format) | rails_jwt_auth/passwords#update |
210
+ | | PUT | /passwords/:id(.:format) | rails_jwt_auth/passwords#update |
211
+ | invitations | POST | /invitations(.:format) | rails_jwt_auth/invitations#create |
212
+ | invitation | PATCH | /invitations/:id(.:format) | rails_jwt_auth/invitations#update |
213
+ | | PUT | /invitations/:id(.:format) | rails_jwt_auth/invitations#update |
214
+
200
215
  ### Session
201
216
 
202
217
  Session api is defined by `RailsJwtAuth::SessionsController`.
@@ -255,11 +270,9 @@ It is necessary to set a value for `confirmations_url` option into `config/initi
255
270
 
256
271
  ```js
257
272
  {
258
- url: host/confirmation,
273
+ url: host/confirmations/:token,
259
274
  method: PUT
260
- data: {
261
- confirmation_token: 'token'
262
- }
275
+ data: {}
263
276
  }
264
277
  ```
265
278
 
@@ -267,7 +280,7 @@ It is necessary to set a value for `confirmations_url` option into `config/initi
267
280
 
268
281
  ```js
269
282
  {
270
- url: host/confirmation,
283
+ url: host/confirmations,
271
284
  method: POST,
272
285
  data: {
273
286
  confirmation: {
@@ -285,7 +298,7 @@ Password api is defined by `RailsJwtAuth::PasswordsController`.
285
298
 
286
299
  ```js
287
300
  {
288
- url: host/password,
301
+ url: host/passwords,
289
302
  method: POST,
290
303
  data: {
291
304
  password: {
@@ -299,10 +312,9 @@ Password api is defined by `RailsJwtAuth::PasswordsController`.
299
312
 
300
313
  ```js
301
314
  {
302
- url: host/password,
315
+ url: host/passwords/:token,
303
316
  method: PUT,
304
317
  data: {
305
- reset_password_token: 'token',
306
318
  password: {
307
319
  password: '1234',
308
320
  password_confirmation: '1234'
@@ -356,7 +368,8 @@ Unlock api is provided by `RailsJwtAuth::UnlocksController`.
356
368
  ```js
357
369
  {
358
370
  url: host/unlocks/:unlock_token,
359
- method: PUT
371
+ method: PUT,
372
+ data: {}
360
373
  }
361
374
  ```
362
375
 
@@ -9,7 +9,7 @@ module RailsJwtAuth
9
9
  end
10
10
 
11
11
  def confirmation_create_params
12
- params.require(:confirmation).permit(:email)
12
+ params.require(:confirmation).permit(RailsJwtAuth.email_field_name)
13
13
  end
14
14
 
15
15
  def session_create_params
@@ -4,7 +4,10 @@ module RailsJwtAuth
4
4
  include RenderHelper
5
5
 
6
6
  def create
7
- user = RailsJwtAuth.model.where(email: confirmation_create_params[:email]).first
7
+ user = RailsJwtAuth.model.where(
8
+ email: confirmation_create_params[RailsJwtAuth.email_field_name]
9
+ ).first
10
+
8
11
  return render_422(email: [{error: :not_found}]) unless user
9
12
 
10
13
  user.send_confirmation_instructions ? render_204 : render_422(user.errors.details)
@@ -4,6 +4,7 @@ module RailsJwtAuth
4
4
  include RenderHelper
5
5
 
6
6
  def create
7
+ authenticate!
7
8
  user = RailsJwtAuth.model.invite!(invitation_create_params)
8
9
  user.errors.empty? ? render_204 : render_422(user.errors.details)
9
10
  end
@@ -4,7 +4,12 @@ module RailsJwtAuth
4
4
  include RenderHelper
5
5
 
6
6
  def create
7
- user = RailsJwtAuth.model.where(email: password_create_params[:email].to_s.downcase).first
7
+ return render_422(email: [{error: :blank}]) if password_create_params[:email].blank?
8
+
9
+ user = RailsJwtAuth.model.where(
10
+ email: password_create_params[:email].to_s.strip.downcase
11
+ ).first
12
+
8
13
  return render_422(email: [{error: :not_found}]) unless user
9
14
 
10
15
  user.send_reset_password_instructions ? render_204 : render_422(user.errors.details)
@@ -46,8 +46,10 @@ module RailsJwtAuth
46
46
  'invalid'
47
47
  end
48
48
 
49
- # abort reset password if exists to allow save
50
- self.reset_password_token = self.reset_password_sent_at = nil if reset_password_token
49
+ # if recoberable module is enabled ensure clean recovery to allow save
50
+ if self.respond_to? :reset_password_token
51
+ self.reset_password_token = self.reset_password_sent_at = nil
52
+ end
51
53
 
52
54
  assign_attributes(params)
53
55
  valid? # validates first other fields
@@ -1,3 +1,3 @@
1
1
  module RailsJwtAuth
2
- VERSION = '1.5.0'
2
+ VERSION = '1.6.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: 1.5.0
4
+ version: 1.6.0
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-06 00:00:00.000000000 Z
11
+ date: 2020-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt
@@ -120,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
122
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.7.3
123
+ rubygems_version: 3.0.3
125
124
  signing_key:
126
125
  specification_version: 4
127
126
  summary: Rails jwt authentication.