summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorImre Farkas <ifarkas@gitlab.com>2018-11-08 16:03:56 +0100
committerImre Farkas <ifarkas@gitlab.com>2018-11-12 12:16:25 +0100
commitf3cd24a9f3f581488d621475e55e3a81bbd9e67c (patch)
tree66266d4ae8b2864a2e8423f7e8022483c357ccb9 /app/controllers
parent369631c84195f6b8b26624d5647ae994e64b77e8 (diff)
downloadgitlab-ce-f3cd24a9f3f581488d621475e55e3a81bbd9e67c.tar.gz
Display impersonation token value only after creationif-53347_fix_impersonation_tokens
Since we migrated all PersonlAccessTokens to store only its hash in the DB, the token value can no longer be shown to the user.
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/impersonation_tokens_controller.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/controllers/admin/impersonation_tokens_controller.rb b/app/controllers/admin/impersonation_tokens_controller.rb
index f5825ecb19a..706bcc1e549 100644
--- a/app/controllers/admin/impersonation_tokens_controller.rb
+++ b/app/controllers/admin/impersonation_tokens_controller.rb
@@ -11,6 +11,7 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController
@impersonation_token = finder.build(impersonation_token_params)
if @impersonation_token.save
+ PersonalAccessToken.redis_store!(current_user.id, @impersonation_token.token)
redirect_to admin_user_impersonation_tokens_path, notice: "A new impersonation token has been created."
else
set_index_vars
@@ -53,6 +54,8 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController
@impersonation_token ||= finder.build
@inactive_impersonation_tokens = finder(state: 'inactive').execute
@active_impersonation_tokens = finder(state: 'active').execute.order(:expires_at)
+
+ @new_impersonation_token = PersonalAccessToken.redis_getdel(current_user.id)
end
# rubocop: enable CodeReuse/ActiveRecord
end