summaryrefslogtreecommitdiff
path: root/app/controllers/concerns
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2023-02-26 20:20:02 -0600
committerHombreLaser <sebastian-440@live.com>2023-02-26 20:20:02 -0600
commit4a1faf270ae328a1a28d9f8f54d9a96ed41a1542 (patch)
treecad4a32a4b1c72fa6bfffeb77fc6fc0fdeba22c8 /app/controllers/concerns
parentc86a5c9e05b183f10a63fb693c8af1d1d5a52e97 (diff)
Añade métodos de controladores faltantes
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r--app/controllers/concerns/token_generation_concern.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/concerns/token_generation_concern.rb b/app/controllers/concerns/token_generation_concern.rb
index 7f43e4c..beab467 100644
--- a/app/controllers/concerns/token_generation_concern.rb
+++ b/app/controllers/concerns/token_generation_concern.rb
@@ -9,12 +9,15 @@ module TokenGenerationConcern
@service ||= Services::TokenGenerationService.new(service_params)
end
- def generate_user_session_key
- @user_account.session_key = SecureRandom.hex(16)
- @user_account.save
+ def generate_user_session_key(user)
+ user.update_attribute(:session_key, SecureRandom.hex(16))
end
def generate_token
{ token: service.call(DateTime.current + 30.minutes), refresh: service.call(DateTime.current + 3.days) }
end
+
+ def service_params
+ { email: @user_account.email, role: @user_account.role, session_key: @user_account.session_key }
+ end
end