mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
819 B
22 lines
819 B
# frozen_string_literal: true
|
|
|
|
class RevealAccessTokenController < ApplicationController
|
|
def show
|
|
authorize!(:manage, current_user.access_token)
|
|
end
|
|
|
|
def create
|
|
authorize!(:manage, current_user.access_token)
|
|
|
|
if current_user.valid_password?(params[:password])
|
|
render turbo_stream: turbo_stream.replace(:access_token_container,
|
|
partial: 'reveal_access_token/access_token',
|
|
locals: { token: current_user.access_token.token })
|
|
else
|
|
render turbo_stream: turbo_stream.replace(:modal, template: 'reveal_access_token/show',
|
|
locals: { error_message: I18n.t('wrong_password') }),
|
|
status: :unprocessable_content
|
|
end
|
|
end
|
|
end
|