mirror of
https://github.com/mastodon/mastodon.git
synced 2025-09-05 09:21:11 +00:00
Merge 682839b0c0
into 14cb5ff881
This commit is contained in:
commit
bb7064f7a7
20
app/controllers/settings/applications/tokens_controller.rb
Normal file
20
app/controllers/settings/applications/tokens_controller.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Settings
|
||||
class Applications::TokensController < BaseController
|
||||
before_action :set_application
|
||||
|
||||
def destroy
|
||||
@access_token = current_user.token_for_app(@application)
|
||||
@access_token.destroy
|
||||
|
||||
redirect_to settings_application_path(@application), notice: t('applications.token_regenerated')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_application
|
||||
@application = current_user.applications.find(params[:application_id])
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Settings::ApplicationsController < Settings::BaseController
|
||||
before_action :set_application, only: [:show, :update, :destroy, :regenerate]
|
||||
before_action :set_application, only: [:show, :update, :destroy]
|
||||
|
||||
def index
|
||||
@applications = current_user.applications.order(id: :desc).page(params[:page])
|
||||
|
@ -45,13 +45,6 @@ class Settings::ApplicationsController < Settings::BaseController
|
|||
redirect_to settings_applications_path, notice: I18n.t('applications.destroyed')
|
||||
end
|
||||
|
||||
def regenerate
|
||||
@access_token = current_user.token_for_app(@application)
|
||||
@access_token.destroy
|
||||
|
||||
redirect_to settings_application_path(@application), notice: I18n.t('applications.token_regenerated')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_application
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
%code= current_user.token_for_app(@application).token
|
||||
%tr
|
||||
%th
|
||||
%td= table_link_to 'refresh', t('applications.regenerate_token'), regenerate_settings_application_path(@application), method: :post
|
||||
%td= table_link_to 'refresh', t('applications.regenerate_token'), settings_application_token_path(@application), method: :delete
|
||||
|
||||
%hr/
|
||||
|
||||
|
|
|
@ -54,9 +54,7 @@ namespace :settings do
|
|||
end
|
||||
|
||||
resources :applications, except: [:edit] do
|
||||
member do
|
||||
post :regenerate
|
||||
end
|
||||
resource :token, module: :applications, only: :destroy
|
||||
end
|
||||
|
||||
resource :delete, only: [:show, :destroy]
|
||||
|
|
Loading…
Reference in New Issue
Block a user