Skip to content
Snippets Groups Projects
Commit 70c65e82 authored by Dennis Tang's avatar Dennis Tang
Browse files

fix case where token may expire

parent 2532dc74
No related branches found
No related tags found
2 merge requests!6393CE upstream - 2018-07-05 12:27 UTC,!6387Prepare 11.1 RC5 EE release
......@@ -171,8 +171,7 @@ def generate_gcp_authorize_url
end
def new_cluster
if GoogleApi::CloudPlatform::Client.new(token_in_session, nil)
.validate_token(expires_at_in_session)
if valid_gcp_token
@new_cluster = ::Clusters::Cluster.new.tap do |cluster|
cluster.build_provider_gcp
end
......@@ -185,6 +184,11 @@ def existing_cluster
end
end
def valid_gcp_token
@valid_gcp_token = GoogleApi::CloudPlatform::Client.new(token_in_session, nil)
.validate_token(expires_at_in_session)
end
def token_in_session
@token_in_session ||=
session[GoogleApi::CloudPlatform::Client.session_key_for_token]
......
......@@ -20,7 +20,7 @@
.tab-content.gitlab-tab-content
.tab-pane{ id: 'create-new-cluster-pane', class: active_when(active_tab == 'new'), role: 'tabpanel' }
= render 'projects/clusters/gcp/header'
- if @token_in_session
- if @valid_gcp_token
= render 'projects/clusters/gcp/form'
- elsif @authorize_url
= link_to @authorize_url do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment