mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-18 00:54:49 +01:00
Change POST /settings/applications/:id
to regenerate token on scopes change (#23359)
Fixes #23096
This commit is contained in:
parent
6a5e447753
commit
20a479ff7c
@ -29,7 +29,13 @@ class Settings::ApplicationsController < Settings::BaseController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
if @application.update(application_params)
|
if @application.update(application_params)
|
||||||
redirect_to settings_applications_path, notice: I18n.t('generic.changes_saved_msg')
|
if @application.scopes_previously_changed?
|
||||||
|
@access_token = current_user.token_for_app(@application)
|
||||||
|
@access_token.destroy
|
||||||
|
redirect_to settings_application_path(@application), notice: I18n.t('applications.token_regenerated')
|
||||||
|
else
|
||||||
|
redirect_to settings_application_path(@application), notice: I18n.t('generic.changes_saved_msg')
|
||||||
|
end
|
||||||
else
|
else
|
||||||
render :show
|
render :show
|
||||||
end
|
end
|
||||||
|
@ -132,7 +132,7 @@ describe Settings::ApplicationsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'redirects back to applications page' do
|
it 'redirects back to applications page' do
|
||||||
expect(call_update).to redirect_to(settings_applications_path)
|
expect(call_update).to redirect_to(settings_application_path(app))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user