Skip to content

Commit

Permalink
alert SSO user of token expiration (#1050)
Browse files Browse the repository at this point in the history
Pr closed.
  • Loading branch information
ShaiahWren authored Oct 7, 2021
1 parent 9e771b0 commit a7f9425
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/containers/token/token-standalone.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
Main,
ClipboardCopy,
EmptyStateUnauthorized,
DateComponent,
} from 'src/components';
import { ActiveUserAPI } from 'src/api';
import { AppContext } from 'src/loaders/app-context';
Expand All @@ -29,6 +30,8 @@ class TokenPage extends React.Component<RouteComponentProps, IState> {
render() {
const { token } = this.state;
let unauthorised = !this.context.user || this.context.user.is_anonymous;
const expiration = this.context.settings.GALAXY_TOKEN_EXPIRATION;
const expirationDate = new Date(Date.now() + 1000 * 60 * expiration);

return (
<React.Fragment>
Expand All @@ -45,6 +48,17 @@ class TokenPage extends React.Component<RouteComponentProps, IState> {
client.
</Trans>
</p>
{!this.context.user.auth_provider.includes('django') && (
<div>
<h2>{t`Expiration`}</h2>
<p>
<Trans>
You are an SSO user. Your token will expire{' '}
<DateComponent date={expirationDate.toISOString()} />.
</Trans>
</p>
</div>
)}
<div className='pf-c-content'>
<Trans>
<b>WARNING</b> loading a new token will delete your old token.
Expand Down

0 comments on commit a7f9425

Please sign in to comment.