simple_jwt_auth 0.1.4 → 0.1.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef5e600d8bca44e3a6951dcbb9dfe0a2497b757eb311fc52e287629eb2c4a931
|
4
|
+
data.tar.gz: 547a3a937faa8cae04af5728e670fe1e375eb2a06aa288897067f70af3cb9d06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a204552f9c1742a47c0277d2f9ecbe00fba8289842da4895a20f695ae1c4d24de0d00f9e242c7ab124d7c03d292afcd5a21d651a2be543d79290c8b895eeef8f
|
7
|
+
data.tar.gz: 6be0c2c6eef0095eb6ce49aaf9c7cd685b1be0b69c5a59e5e72d27f920084eeadd4355551c804e06b686cf2cc41a88290034f876cacf09e20f5b78dd43cbc12e
|
@@ -12,7 +12,7 @@ class SessionsController < ApplicationController
|
|
12
12
|
Rails.application.credentials.fetch(:secret_key_base), # the secret key
|
13
13
|
"HS256" # the encryption algorithm
|
14
14
|
)
|
15
|
-
render json: { jwt: jwt, email: user.email, user_id: user.id }, status: :created
|
15
|
+
render json: { jwt: jwt, email: user.email, user_id: user.id, isPasswordReset: user.isPasswordReset }, status: :created
|
16
16
|
else
|
17
17
|
render json: {}, status: :unauthorized
|
18
18
|
end
|
@@ -17,9 +17,29 @@ class UsersController < ApplicationController
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def update
|
21
|
+
if current_user
|
22
|
+
user = User.find_by_id(current_user.id)
|
23
|
+
user.isPasswordReset = true
|
24
|
+
user.update(update_params)
|
25
|
+
|
26
|
+
if user.save
|
27
|
+
render json: {message: "User updated successfully"}, status: :ok
|
28
|
+
else
|
29
|
+
render json: {errors: user.errors.full_messages}, status: :bad_request
|
30
|
+
end
|
31
|
+
else
|
32
|
+
render json: {}, status: :unauthorized
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
20
36
|
private
|
21
37
|
|
22
38
|
def user_params
|
23
39
|
params.permit(:name, :email, :password, :password_confirmation)
|
24
|
-
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def update_params
|
43
|
+
params.permit(:password, :password_confirmation)
|
44
|
+
end
|
25
45
|
end
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_jwt_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- brye
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -109,7 +109,7 @@ homepage: https://github.com/bryewalks/simple_auth
|
|
109
109
|
licenses:
|
110
110
|
- MIT
|
111
111
|
metadata: {}
|
112
|
-
post_install_message:
|
112
|
+
post_install_message:
|
113
113
|
rdoc_options: []
|
114
114
|
require_paths:
|
115
115
|
- lib
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubygems_version: 3.0.6
|
128
|
-
signing_key:
|
128
|
+
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: JWT based authorization
|
131
131
|
test_files: []
|