Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alert SSO user of token expiration #1050

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
himdel marked this conversation as resolved.
Show resolved Hide resolved
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