diff options
author | HombreLaser <sebastian-440@live.com> | 2023-02-26 20:19:22 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2023-02-26 20:19:22 -0600 |
commit | c86a5c9e05b183f10a63fb693c8af1d1d5a52e97 (patch) | |
tree | b8dd53b21b7e6ef9450ceeea3c61208a32052c64 /app/controllers/authenticated_controller.rb | |
parent | 64171389726e6fde709f3f567eb27c5c94496b81 (diff) |
Refactoriza los create logics
Diffstat (limited to 'app/controllers/authenticated_controller.rb')
-rw-r--r-- | app/controllers/authenticated_controller.rb | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/app/controllers/authenticated_controller.rb b/app/controllers/authenticated_controller.rb index 2602064..56be1ad 100644 --- a/app/controllers/authenticated_controller.rb +++ b/app/controllers/authenticated_controller.rb @@ -12,23 +12,6 @@ class AuthenticatedController < ApplicationController render json: { error_message: 'Token inválido' }, status: :unauthorized end - def decoded_token - @decoded_token ||= JWT.decode(authentication_token, ENV['HMAC_SECRET_KEY'], true, { algorithm: 'HS512' }) - rescue JWT::ExpiredSignature - @decoded_token = nil - end - - def current_user_account - return if decoded_token.nil? - - email = decoded_token[0]['data'] - @current_user_account ||= UserAccount.find_by(email:) - end - - def authentication_token - @authentication_token ||= request.headers[:authorization]&.sub(/^Bearer /, '') - end - def valid_token !(decoded_token.nil? || current_user_account&.session_key.nil? || invalid_jti) end |