summaryrefslogtreecommitdiff
path: root/app/controllers/api/authentications_controller
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-02-24 23:25:26 -0600
committerHombreLaser <sebastian-440@live.com>2023-02-24 23:25:26 -0600
commite1a240c563b0e10e0ceae7c167fdcde752f3d865 (patch)
tree05408f95e5896f243bcd010dd01153ad78f35d7d /app/controllers/api/authentications_controller
parent0307ed7be55784cc54a2055c22bc5465405832ea (diff)
Añade autenticación
Diffstat (limited to 'app/controllers/api/authentications_controller')
-rw-r--r--app/controllers/api/authentications_controller/create_logic.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/controllers/api/authentications_controller/create_logic.rb b/app/controllers/api/authentications_controller/create_logic.rb
index 743eed9..c62c300 100644
--- a/app/controllers/api/authentications_controller/create_logic.rb
+++ b/app/controllers/api/authentications_controller/create_logic.rb
@@ -14,7 +14,8 @@ module Api
return unless @user_account&.authenticate(@password)
@user_account.session_key = SecureRandom.hex(16)
- jwt = { token: service.call(DateTime.now + 30.minutes), refresh: service.call(DateTime.now + 3.days) }
+ @user_account.save
+ { token: service.call(DateTime.current + 30.minutes), refresh: service.call(DateTime.current + 3.days) }
end
private
@@ -24,7 +25,7 @@ module Api
end
def service_params
- { email: @email, role: @user_account.role }
+ { email: @email, role: @user_account.role, session_key: @user_account.session_key }
end
end
end