summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDennis Tang <dtang@gitlab.com>2018-06-05 21:47:09 -0700
committerDennis Tang <dtang@gitlab.com>2018-06-05 21:47:09 -0700
commit08d513a59e3cc2aa09b91217773267f3d3fd5653 (patch)
treecc952e591df0724ba4548660a543485530e77faa /app
parentedb89f555b25aa4d4aad7a3bdf5a0bd75bd076fc (diff)
downloadgitlab-ce-08d513a59e3cc2aa09b91217773267f3d3fd5653.tar.gz
redirect back to form if token expires
Diffstat (limited to 'app')
-rw-r--r--app/controllers/projects/clusters/gcp_controller.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/app/controllers/projects/clusters/gcp_controller.rb b/app/controllers/projects/clusters/gcp_controller.rb
index ac9a906fe47..9741164377b 100644
--- a/app/controllers/projects/clusters/gcp_controller.rb
+++ b/app/controllers/projects/clusters/gcp_controller.rb
@@ -7,17 +7,21 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
helper_method :valid_gcp_token
def create
- @cluster = ::Clusters::CreateService
- .new(project, current_user, create_params)
- .execute(token_in_session)
+ if valid_gcp_token
+ @cluster = ::Clusters::CreateService
+ .new(project, current_user, create_params)
+ .execute(token_in_session)
- if @cluster.persisted?
- redirect_to project_cluster_path(project, @cluster)
- else
- @gcp_cluster = @cluster
- user_cluster
+ if @cluster.persisted?
+ redirect_to project_cluster_path(project, @cluster)
+ else
+ @gcp_cluster = @cluster
+ user_cluster
- render 'projects/clusters/new', locals: { active_tab: 'gcp' }
+ render 'projects/clusters/new', locals: { active_tab: 'gcp' }
+ end
+ else
+ redirect_to new_project_cluster_path(@project)
end
end