From 41a17f47ae275f8e84de03115e142cc23526bacc Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Fri, 3 Mar 2023 20:34:06 -0600 Subject: AƱade refactorizaciones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/refresh_tokens_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/controllers/api/refresh_tokens_controller.rb') diff --git a/app/controllers/api/refresh_tokens_controller.rb b/app/controllers/api/refresh_tokens_controller.rb index 3b0843e..fd16079 100644 --- a/app/controllers/api/refresh_tokens_controller.rb +++ b/app/controllers/api/refresh_tokens_controller.rb @@ -3,16 +3,17 @@ module Api # The controller to generate new tokens. class RefreshTokensController < AuthenticatedController + before_action :validate_jwt + def create @current_user_account.update_attribute(:session_key, SecureRandom.hex(16)) - @token = { token: service.call(DateTime.current + 30), refresh: service.call(authentication_token[0]['exp']) } + @token = service.call(authentication_token[0]['exp']) render json: @token, status: :ok end def service_params - { email: @current_user_account.email, role: @current_user_account.role, - session_key: @current_user_account.session_key } + { email: @current_user_account.email, role: @current_user_account.role } end def service -- cgit v1.2.3