ironmansoftware / universal-dashboard

Build beautiful websites with PowerShell.
https://universaldashboard.io
GNU Lesser General Public License v3.0
448 stars 83 forks source link

-AutoRefresh keeps $User value, but not $Session values #292

Open mkellerman opened 6 years ago

mkellerman commented 6 years ago

I set a $Session:CUSTOMER_ID value when the user login's. Strangely, when i save the dashboard and it autorefreshes, it keeps me logged in, but looses Session variables. Here is what i do:

    if ($Credentials.UserName -eq "guest" -and $Credentials.GetNetworkCredential().Password -eq "guest") {
        New-UDAuthenticationResult -Success -UserName "Guest User"
        $SESSION:CUSTOMER_ID = 0
    }

Expected behavior, when the site reloads, it should boot everyone out, or keep users session variables.

mkellerman commented 6 years ago

Maybe there is a better way to associate information to the $User ?

Would love a $AuthenticatedUser variable, that we can add custom properties or get the user info from database?!

mkellerman commented 6 years ago

Actually, after some testing, that $Session variable doesn't even gets set on the first login.. something fishy going on with Session variables at that stage of the game.