Implement signout feature in dashboard

Product: PowerShell Universal
Version: 1.5.9

I have the dashboard implemented and working as expected using Root “/” so when user visit the URL the user needs to login and after success the user will be taken directly to the dashboard.

the issue is if the user close the browser and reopen and try to visit the URL again, no authentication is populated and the user will be presented with the dashboard right away.

the question is how to implement a signout button in the dashboard to logout the user when clicked without having the user go to /admin page to signout.
Note: in the above scenario users are not and should not be aware of /admin page.

Thank you.

Hello @wsl2001 I am guessing this is a feature request for Powershell Universal, however if you looking for a workaround, then I did do this custom component:-
https://marketplace.universaldashboard.io/Dashboard/UniversalDashboard.UDStickyNavbar
Which you could implement the same hyperlink which is used for the signout into this sticky navbar. Just a thought :thinking:

@psDevUK
Thank you for the idea, it might work this way but am trying to find what command initiate the sign out as well so if i chose to use a component i can implement the sign out code in it.

do you use the form base authentication ? or something else ?
the endpoint is '/api/v1/signout

@AlonGvili
am using form base authentication

Second this!
A sign out button or what ever should be perfect in the navbar!

@adam maybe something to put in the add function list?

1 Like

Dear @adam

I saw that you just implemented this :smiley:

However can I ask you how can we enable the button? It’s not there by default (at least not in the nightly 1.5.15) and I didn’t see a specific parameter for New-UDDashboard.

Thanks for the clarification!

Best,
Don

should be coming in PowerShell Universal 1.5.16

Hey @wsl2001

OK understand but since Adam flagged it as “Fixed in Nightly Build” I thought it’s already there… But maybe in the nightly builds of v.1.6? :wink:
…I haven’t tested yet.

Thanks,
Don

Hmmm I thought that was merged into the 1.6 nightly build. I’ll have to look. We don’t do 1.5 nightly builds.

OK thanks for the clarification.
However there is a nightly build of 1.5.15 dated April 13th… And I’m using this one right now which contains already a lot of fixes from you… :wink:

KR
Don

Ah. Yeah sometimes we publish those builds for customers to try out fixes before they are released to ensure that they fix the issue in their environment.

@adam

The new signout feature in 1.5.16 works fine except when clicked it ends up with blank page, i think it would be much nicer to have the signout redirect to the login screen instead of a blank page.

Yes, I can confirm what @wsl2001 said as well. It executes the signoff API call and then just “sits” there.
A redirect to the login screen should be triggered just after the signout and then it would be perfect! :+1:t2:

Strange…We’ll get that fixed…

Dear @adam

Thanks for having fixed that issue in a recent release.
However would it be possible to slightly improve the redirection after the logout?
Right now you do a normal redirect to /login.
The problem with that is that if you try to login again with an account that has admin rights, you’re automatically logged-on into the admin interface. Maybe that’s not something you want.

So would it be possible to include the ReturnUrl as well in the redirection page after a logout is performed? Like that when somebody logs back in it lands automatically on the Dashboard where he has left.

…hope this makes sense, otherwise I’m glad to understand how I can manage this “dynamic” Dashboard assignment / redirection based on role membership… Maybe I’ve missed something in the docs…?

Thanks,
Don

I totally agree with this, i just tested i find out that after sign out if you try to sign in it will take you back to admin page and it should not it should take you back to dashboard.

1 Like

I can make this change. I agree that this makes sense as well.

1 Like

Also, would it be possible to remove the logout option all together for users with windows authentication?

At the moment, when a user press logout, I redirect the user to the main page again.

Yep. I can get that change as well.