Files
docuseal/app/controllers/api_settings_controller.rb
Oleksandr Turchyn e9d728fa4a add i18n
2024-09-23 11:45:07 +03:00

18 lines
457 B
Ruby

# frozen_string_literal: true
class ApiSettingsController < ApplicationController
def index
authorize!(:read, current_user.access_token)
end
def create
authorize!(:manage, current_user.access_token)
current_user.access_token.token = SecureRandom.base58(AccessToken::TOKEN_LENGTH)
current_user.access_token.save!
redirect_back(fallback_location: settings_api_index_path, notice: I18n.t('api_token_has_been_updated'))
end
end