New LoginPage - not showing

Product: PowerShell Universal
Version: 1.5.0
PS 7.0.0

Just tossed the new PSUniversal on my lab box. I was trying to toss up a customized login page following the documentation. I basically took the code block and customized it to my scenario, then saved loginPage.ps1 in the Repository/.universal folder. Restarted service and no change on the login page.

I’ve also tried moving the file to just the Repository folder (documentation wasn’t clear on if it should be in the root, or with the other Universal ps1 files. Curious to know which log i should be looking at to determine the failure.

It should be in the .universal folder. Did you enter a license? Customizing the login page requires one. I just added a log message to indicate this.

We’ll probably add some UI for this in the admin console sometime to make this more obvious.

My lab has a Universal Dashboard and API license setup on it. nothing beyond that at this point.

Just tried the example on the docs and realized there was a typo. You should see the error in the PSU logs in %ProgramData%\PowerShellUniversal.

I fixed it and then tried this. The problem was that value ‘white’ for HeaderFontColor didn’t have quotes around it.

$LoginPage = @{
    PrimaryColor = '#5c2751' 
    Title = 'DBATools Web Portal'
    Copyright = 'DBATools 2020' 
    HeaderFontColor = 'white'
    HeaderColor = '#4bc0d9' 
    SecondaryColor = '#6457a6'
    SecondaryFontColor = 'white'
   }
   
   New-PSULoginPage @LoginPage

And now I have colors.

I’m sorry, i should have stated this part. I fixed the quotes on both the the HeaderFrontColor and the Image properties from your code example. No change.

Hmmm ok. Let get the logging integrated so that we have something to go on. Right now it’s probably failing pretty silently.

I’m having the exact same issue. Brand new Windows VM and copied code straight from the documentation and been trying from this thread. Also tried the below and am not getting any luck. More thorough documentation on this feature and authentication would be greatly appreciated.

I am licensed as well.

Start-PSUServer -Port 8080 -Configuration {

    New-PSUEndpoint -Url '/hello' -Method GET -Endpoint {

        'Hello'

    }

    New-PSUDashboard -Name 'Dashboard' -BaseUrl '/dashboard' -Framework 'UniversalDashboard:Latest' -Content {

        New-UDDashboard -Title 'Hello, World' -Content {

            New-UDForm -Content {

                New-UDTextbox -Label 'Say Hi' -Id 'textbox'

            } -OnSubmit {

                Show-UDToast -Message $EventData.textbox

            }

        }

    }

    $LoginPage = @{

        PrimaryColor = '#5c2751' 

        Title = 'DBATools Web Portal'

        Copyright = 'DBATools 2020' 

        HeaderFontColor = 'white'

        HeaderColor = '#4bc0d9' 

        SecondaryColor = '#6457a6'

        SecondaryFontColor = 'white'

    }

       

       New-PSULoginPage @LoginPage

} -ExecutablePath (Join-Path $Path "Universal.Server.exe")

We got to the bottom of this. It was only working for certain types of licenses but not others. It’s been fixed in main and will be in the 1.5.1 release.

2 Likes

I am still not seeing the custom login page. I have a licensed copy and I upgraded to 1.5.2, copied the code from your example above into loginPage.ps1 in my dashboards Repository folder and restarted the service. The default login page remains. I do not see anything in the logs indicating any errors. I am using the code below.

$LoginPage = @{
PrimaryColor = ‘#5c2751
Title = ‘DBATools Web Portal’
Copyright = ‘DBATools 2020’
HeaderFontColor = ‘white’
HeaderColor = ‘#4bc0d9
SecondaryColor = ‘#6457a6
SecondaryFontColor = ‘white’
}
New-PSULoginPage @LoginPage

A couple thing to check.

You can invoke the API directly to see what is being returned. You don’t need an app token to invoke this API.

Invoke-RestMethod http://localhost:5000/api/v1/loginPage

If it is an issue with the license key, you will see this warning in the log:

Login pages require a license.

This returns a null value and in the logs I have this
2020-11-24T12:35:02.8727621-05:00 0HM4GJT36EGI4:00000001 [INF] Request starting HTTP/1.1 GET http://localhost:5000/api/v1/loginPage (ca22a1cb)
2020-11-24T12:35:02.8996383-05:00 0HM4GJT36EGI4:00000001 [WRN] Failed to determine the https port for redirect. (ca76cc21)
2020-11-24T12:35:03.0082332-05:00 0HM4GJT36EGI4:00000001 [INF] Executing endpoint ‘“UniversalAutomation.LoginPageController.Get (UniversalAutomation)”’ (500cc934)
2020-11-24T12:35:03.0300877-05:00 0HM4GJT36EGI4:00000001 [INF] Route matched with “{action = “Get”, controller = “LoginPage”}”. Executing controller action with signature “UniversalAutomation.LoginPage Get()” on controller “UniversalAutomation.LoginPageController” (“UniversalAutomation”). (122b2fdf)
2020-11-24T12:35:03.1508543-05:00 0HM4GJT36EGI4:00000001 [INF] Executing ObjectResult, writing value of type ‘“null”’. (8a1b66c8)
2020-11-24T12:35:03.1555283-05:00 0HM4GJT36EGI4:00000001 [INF] Executed action “UniversalAutomation.LoginPageController.Get (UniversalAutomation)” in 121.0024ms (afa2e885)
2020-11-24T12:35:03.1565237-05:00 0HM4GJT36EGI4:00000001 [INF] Executed endpoint ‘“UniversalAutomation.LoginPageController.Get (UniversalAutomation)”’ (99874f2b)
2020-11-24T12:35:03.1603492-05:00 0HM4GJT36EGI4:00000001 [INF] Request finished in 290.8216ms 204 (791a596a)

What product type is listed in the licenses page?

Just to 100% clear with how I have this configured, here’s my current login page configuration. It’s stored in %ProgramData%\UniversalAutomation\Repository\.universal\loginPage.ps1

The Product in my License is “Universal Dashboard and API” and I have confirmed the loginPage.ps1 is in the folder you indicated %ProgramData%\UniversalAutomation\Repository.universal\loginPage.ps1.

Apologies. We actually had two issues with this and I didn’t realize it. The problem is that if you restart the server, the changes are not reloaded properly. If you make a change with the server running, you should notice the login page display correctly. The other issue was that single-file configurations worked which is how our integration tests were setup for this particular case so it did not catch the issue automatically. We’ve fixed this and it will be in the next nightly and the 1.5.3 build.

Thank you, I was able to confirm that editing the loginPage.ps1 while the dashboard is running does show the updated login page.

1 Like

I have confirmed the login page is working in 1.5.3 as expected.

Can we customize the login page more than the example provided? I modified the running CSS in the browser, and would really like to complete the loginpage.ps1 to look something like this.