diff options
author | Dennis Tang <dtang@gitlab.com> | 2018-06-05 21:47:09 -0700 |
---|---|---|
committer | Dennis Tang <dtang@gitlab.com> | 2018-06-05 21:47:09 -0700 |
commit | 08d513a59e3cc2aa09b91217773267f3d3fd5653 (patch) | |
tree | cc952e591df0724ba4548660a543485530e77faa /app | |
parent | edb89f555b25aa4d4aad7a3bdf5a0bd75bd076fc (diff) | |
download | gitlab-ce-08d513a59e3cc2aa09b91217773267f3d3fd5653.tar.gz |
redirect back to form if token expires
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/clusters/gcp_controller.rb | 22 |
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 |