Expire login links

This commit is contained in:
2023-11-18 18:34:08 +11:00
parent 3b3ad66ba3
commit ef70633aa5

View File

@@ -5,9 +5,16 @@ module Admin
include Deps["repos.login_tokens_repo"] include Deps["repos.login_tokens_repo"]
def call(token:) def call(token:)
user_id = login_tokens_repo.by_token(token: token).user_id token = login_tokens_repo.by_token(token: token)
if user_id
if (Time.now - token.created_at) > 15
login_tokens_repo.delete_all login_tokens_repo.delete_all
return nil
end
user_id = token.user_id
if user_id
user_id user_id
end end
end end