From 53c55cbf14899d83023cf2e9b11ed204e7b630d3 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Fri, 24 Feb 2023 21:28:48 -0600 Subject: Refactoriza create_logic --- app/controllers/api/authentications_controller/create_logic.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/controllers/api/authentications_controller') diff --git a/app/controllers/api/authentications_controller/create_logic.rb b/app/controllers/api/authentications_controller/create_logic.rb index e3af94d..743eed9 100644 --- a/app/controllers/api/authentications_controller/create_logic.rb +++ b/app/controllers/api/authentications_controller/create_logic.rb @@ -11,9 +11,10 @@ module Api end def call - jwt = { token: service.call(DateTime.now + 30.minutes), refresh: service.call(DateTime.now + 3.days) } + return unless @user_account&.authenticate(@password) - return jwt if @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) } end private -- cgit v1.2.3