cartodb-4.42/app/models/carto/helpers/auth_token_generator.rb
2024-04-06 05:25:13 +00:00

20 lines
345 B
Ruby

module Carto
module AuthTokenGenerator
def get_auth_token
auth_token || generate_and_save_auth_token
end
private
def generate_and_save_auth_token
self.auth_token = generate_auth_token
save
auth_token
end
def generate_auth_token
SecureRandom.urlsafe_base64(nil, false)
end
end
end