Skip to content

Commit 08ca019

Browse files
committed
community - fix token page expiration notice when auth provider is github
allow for null token expiration, but also don't treat github as SSO Issue: AAH-2324
1 parent d3a25d8 commit 08ca019

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

CHANGES/2324.bug

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
community - fix token page expiration notice when auth provider is github

src/containers/token/token-standalone.tsx

+21-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ class TokenStandalone extends React.Component<RouteProps, IState> {
3939
const { token, alerts, loadingToken } = this.state;
4040
const unauthorised = !this.context.user || this.context.user.is_anonymous;
4141
const expiration = this.context.settings.GALAXY_TOKEN_EXPIRATION;
42-
const expirationDate = new Date(Date.now() + 1000 * 60 * expiration);
42+
const expirationDate = expiration
43+
? new Date(Date.now() + 1000 * 60 * expiration)
44+
: null;
45+
const isSSO =
46+
!this.context.user.auth_provider.includes('django') &&
47+
!this.context.user.auth_provider.includes('github');
4348

4449
return (
4550
<React.Fragment>
@@ -61,14 +66,24 @@ class TokenStandalone extends React.Component<RouteProps, IState> {
6166
<code>ansible-galaxy</code> client.
6267
</Trans>
6368
</p>
64-
{!this.context.user.auth_provider.includes('django') && (
69+
{isSSO && (
6570
<div>
6671
<h2>{t`Expiration`}</h2>
6772
<p>
68-
<Trans>
69-
You are an SSO user. Your token will expire{' '}
70-
<DateComponent date={expirationDate.toISOString()} />.
71-
</Trans>
73+
<Trans>You are an SSO user.</Trans>{' '}
74+
{expirationDate ? (
75+
<Trans>
76+
Your token will expire{' '}
77+
<DateComponent
78+
date={expirationDate.toISOString()}
79+
/>
80+
.
81+
</Trans>
82+
) : (
83+
<Trans>
84+
Your token will not expire.
85+
</Trans>
86+
)}
7287
</p>
7388
</div>
7489
)}

0 commit comments

Comments
 (0)