From f4248bf16c79d7349a217477b347bf0bfb155581 Mon Sep 17 00:00:00 2001
From: Chelsea Shaw <82459713+hashishaw@users.noreply.github.com>
Date: Fri, 9 Feb 2024 12:38:55 -0600
Subject: [PATCH] UI: Redirect after logging in from token expiry (#25335)
* Redirect after logging in from token expiry. Fixes #10963
* Add changelog
---
changelog/25335.txt | 3 +++
ui/app/components/token-expire-warning.hbs | 8 +++++++-
ui/app/components/token-expire-warning.js | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)
create mode 100644 changelog/25335.txt
diff --git a/changelog/25335.txt b/changelog/25335.txt
new file mode 100644
index 0000000000..b931d47f4a
--- /dev/null
+++ b/changelog/25335.txt
@@ -0,0 +1,3 @@
+```release-note:improvement
+ui: redirect back to current route after reauthentication when token expires
+```
diff --git a/ui/app/components/token-expire-warning.hbs b/ui/app/components/token-expire-warning.hbs
index 43d68c2039..3d56bd129f 100644
--- a/ui/app/components/token-expire-warning.hbs
+++ b/ui/app/components/token-expire-warning.hbs
@@ -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.
-
+
{{else}}
diff --git a/ui/app/components/token-expire-warning.js b/ui/app/components/token-expire-warning.js
index 5b9419bd9c..2fb4bd8adf 100644
--- a/ui/app/components/token-expire-warning.js
+++ b/ui/app/components/token-expire-warning.js
@@ -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) {