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

UI: Redirect after logging in from token expiry #25335

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions changelog/25335.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
ui: redirect back to current route after reauthentication when token expires
```
8 changes: 7 additions & 1 deletion ui/app/components/token-expire-warning.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@
Your auth token expired on
{{date-format @expirationDate "MMMM do yyyy, h:mm:ss a"}}. You will need to re-authenticate.
</A.Description>
<A.Link::Standalone @icon="arrow-right" @iconPosition="trailing" @text="Reauthenticate" @route="vault.cluster.logout" />
<A.Link::Standalone
@icon="arrow-right"
@iconPosition="trailing"
@text="Reauthenticate"
@route="vault.cluster.logout"
@query={{this.queryParams}}
/>
</Hds::Alert>
{{else}}
<section class="section">
Expand Down
5 changes: 5 additions & 0 deletions ui/app/components/token-expire-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export default class TokenExpireWarning extends Component {
yield this.handleRenew();
}

get queryParams() {
// Bring user back to current page after login
return { redirect_to: this.router.currentURL };
}

get showWarning() {
const currentRoute = this.router.currentRouteName;
if ('vault.cluster.oidc-provider' === currentRoute) {
Expand Down
Loading