about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-02-02 12:03:49 +0100
committerGitHub <noreply@github.com>2023-02-02 12:03:49 +0100
commit20a479ff7c3bcd8e5c223dae53b30b174d87f1bf (patch)
tree434a876c31275eb3be5f9d538801f85955e32f65 /app/controllers
parent6a5e447753095606e42cc3899887ba7fae77a0e8 (diff)
Change `POST /settings/applications/:id` to regenerate token on scopes change (#23359)
Fixes #23096
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/settings/applications_controller.rb8
1 files changed, 7 insertions, 1 deletions
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