From 20a479ff7c3bcd8e5c223dae53b30b174d87f1bf Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 2 Feb 2023 12:03:49 +0100 Subject: Change `POST /settings/applications/:id` to regenerate token on scopes change (#23359) Fixes #23096 --- app/controllers/settings/applications_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/settings/applications_controller.rb b/app/controllers/settings/applications_controller.rb index d3ac268d8..e6e137c2b 100644 --- a/app/controllers/settings/applications_controller.rb +++ b/app/controllers/settings/applications_controller.rb @@ -29,7 +29,13 @@ class Settings::ApplicationsController < Settings::BaseController def update 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 render :show end -- cgit