summaryrefslogtreecommitdiff
path: root/app/controllers/api/refresh_tokens_controller.rb
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-03-03 20:34:06 -0600
committerHombreLaser <sebastian-440@live.com>2023-03-03 20:34:06 -0600
commit41a17f47ae275f8e84de03115e142cc23526bacc (patch)
tree2fb62f78685698a7c55bf5cff8456d24b7a78361 /app/controllers/api/refresh_tokens_controller.rb
parent094ee717f710ea4cf81d221c5bf9660b805da9b1 (diff)
Añade refactorizaciones
Diffstat (limited to 'app/controllers/api/refresh_tokens_controller.rb')
-rw-r--r--app/controllers/api/refresh_tokens_controller.rb7
1 files changed, 4 insertions, 3 deletions
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