public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH] fix #7337: Keep track of deep link on OpenID login
@ 2026-03-12 14:30 Arthur Bied-Charreton
  2026-03-19 10:05 ` Shannon Sterz
  0 siblings, 1 reply; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-03-12 14:30 UTC (permalink / raw)
  To: pbs-devel

Previously, when opening a deep link without being logged into PBS, the
hash was getting lost, redirecting the user to #pbsDashboard instead of
/#<deeplink>.

Store `window.location.hash` in sessionStorage (per-tab storage) before
redirecting to the login URL, and add it to the history after successful
login to direct the user to the deeplink they opened.

`#pbsDashboard` remains the default redirect if no deeplink is stored.

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
 www/LoginView.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/www/LoginView.js b/www/LoginView.js
index fd9594f6..b72e4223 100644
--- a/www/LoginView.js
+++ b/www/LoginView.js
@@ -48,6 +48,7 @@ Ext.define('PBS.LoginView', {
 
             if (this.getViewModel().data.openid === true) {
                 const redirectURL = location.origin;
+                sessionStorage.setItem('openid-deeplink', location.hash);
                 try {
                     let resp = await Proxmox.Async.api2({
                         url: '/api2/extjs/access/openid/auth-url',
@@ -217,7 +218,13 @@ Ext.define('PBS.LoginView', {
                                 let creds = response.result.data;
                                 PBS.Utils.updateLoginData(creds);
                                 PBS.app.changeView('mainview');
-                                history.replaceState(null, '', `${redirectURL}#pbsDashboard`);
+                                let deeplink = sessionStorage.getItem('openid-deeplink');
+                                if (deeplink) {
+                                    sessionStorage.removeItem('openid-deeplink');
+                                    history.replaceState(null, '', `${redirectURL}${deeplink}`);
+                                } else {
+                                    history.replaceState(null, '', `${redirectURL}#pbsDashboard`);
+                                }
                             },
                         });
                     }
-- 
2.47.3




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix #7337: Keep track of deep link on OpenID login
  2026-03-12 14:30 [PATCH] fix #7337: Keep track of deep link on OpenID login Arthur Bied-Charreton
@ 2026-03-19 10:05 ` Shannon Sterz
  2026-03-19 10:56   ` superseded " Arthur Bied-Charreton
  0 siblings, 1 reply; 3+ messages in thread
From: Shannon Sterz @ 2026-03-19 10:05 UTC (permalink / raw)
  To: Arthur Bied-Charreton; +Cc: pbs-devel

On Thu Mar 12, 2026 at 3:30 PM CET, Arthur Bied-Charreton wrote:
> Previously, when opening a deep link without being logged into PBS, the
> hash was getting lost, redirecting the user to #pbsDashboard instead of
> /#<deeplink>.
>
> Store `window.location.hash` in sessionStorage (per-tab storage) before
> redirecting to the login URL, and add it to the history after successful
> login to direct the user to the deeplink they opened.
>
> `#pbsDashboard` remains the default redirect if no deeplink is stored.
>
> Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
> ---
>  www/LoginView.js | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/www/LoginView.js b/www/LoginView.js
> index fd9594f6..b72e4223 100644
> --- a/www/LoginView.js
> +++ b/www/LoginView.js
> @@ -48,6 +48,7 @@ Ext.define('PBS.LoginView', {
>
>              if (this.getViewModel().data.openid === true) {
>                  const redirectURL = location.origin;
> +                sessionStorage.setItem('openid-deeplink', location.hash);

nit: i think it would be nicer if this was prefixed, so something like
"pbs-openid-deeplink". also quickly grep-ing over the widget toolkit and
pbs ui directory, it seems that for local storage we tend to prefer
camel case, though that isn't consistent.

>                  try {
>                      let resp = await Proxmox.Async.api2({
>                          url: '/api2/extjs/access/openid/auth-url',
> @@ -217,7 +218,13 @@ Ext.define('PBS.LoginView', {
>                                  let creds = response.result.data;
>                                  PBS.Utils.updateLoginData(creds);
>                                  PBS.app.changeView('mainview');
> -                                history.replaceState(null, '', `${redirectURL}#pbsDashboard`);
> +                                let deeplink = sessionStorage.getItem('openid-deeplink');
> +                                if (deeplink) {
> +                                    sessionStorage.removeItem('openid-deeplink');
> +                                    history.replaceState(null, '', `${redirectURL}${deeplink}`);
> +                                } else {
> +                                    history.replaceState(null, '', `${redirectURL}#pbsDashboard`);
> +                                }
>                              },
>                          });
>                      }

other than the small nit above, this looks good to me so consider this:

Reviewed-by: Shannon Sterz <s.sterz@proxmox.com>





^ permalink raw reply	[flat|nested] 3+ messages in thread

* superseded [PATCH] fix #7337: Keep track of deep link on OpenID login
  2026-03-19 10:05 ` Shannon Sterz
@ 2026-03-19 10:56   ` Arthur Bied-Charreton
  0 siblings, 0 replies; 3+ messages in thread
From: Arthur Bied-Charreton @ 2026-03-19 10:56 UTC (permalink / raw)
  To: Shannon Sterz; +Cc: pbs-devel

On Thu, Mar 19, 2026 at 11:05:37AM +0100, Shannon Sterz wrote:
> On Thu Mar 12, 2026 at 3:30 PM CET, Arthur Bied-Charreton wrote:
> > Previously, when opening a deep link without being logged into PBS, the
> > hash was getting lost, redirecting the user to #pbsDashboard instead of
> > /#<deeplink>.
> >
> > Store `window.location.hash` in sessionStorage (per-tab storage) before
> > redirecting to the login URL, and add it to the history after successful
> > login to direct the user to the deeplink they opened.
> >
> > `#pbsDashboard` remains the default redirect if no deeplink is stored.
> >
> > Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
> > ---
> >  www/LoginView.js | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/www/LoginView.js b/www/LoginView.js
> > index fd9594f6..b72e4223 100644
> > --- a/www/LoginView.js
> > +++ b/www/LoginView.js
> > @@ -48,6 +48,7 @@ Ext.define('PBS.LoginView', {
> >
> >              if (this.getViewModel().data.openid === true) {
> >                  const redirectURL = location.origin;
> > +                sessionStorage.setItem('openid-deeplink', location.hash);
> 
> nit: i think it would be nicer if this was prefixed, so something like
> "pbs-openid-deeplink". also quickly grep-ing over the widget toolkit and
> pbs ui directory, it seems that for local storage we tend to prefer
> camel case, though that isn't consistent.
> 
Ack, thanks for the suggestion! Added in v2:
superseded by:
https://lore.proxmox.com/pbs-devel/20260319105507.266484-1-a.bied-charreton@proxmox.com/T/#u




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-19 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-12 14:30 [PATCH] fix #7337: Keep track of deep link on OpenID login Arthur Bied-Charreton
2026-03-19 10:05 ` Shannon Sterz
2026-03-19 10:56   ` superseded " Arthur Bied-Charreton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal