Appsettings.json and custom login page

,

Moved to Umbraco 16 and the settings to customize the login screen seem to not take affect anymore.

appsettings.json
“LoginLogoImage”: “/media/…”,
“LoginLogoImageAlternative”: “/media/…”,
“LoginBackgroundImage”: “/media/…”,

login page
<umb-auth-layout background-image=“/umbraco/management/api/v1/security/back-office/graphics/login-background” logo-image=“/umbraco/management/api/v1/security/back-office/graphics/login-logo” logo-image-alternative=“/umbraco/management/api/v1/security/back-office/graphics/login-logo-alternative”…

those values don’t change anymore based off the setting in appsettings.json

previously those values were inserted like:

<umb-auth-layout background-image=“/media/5b3pl5ot/login-banner.jpg” logo-image=“/media/5cije2jp/logo-color.svg” logo-image-alternative=“/media/5cije2jp/logo-color-small.svg” …

They still work, I use them in every project.

  • Make sure the settings are correctly nested in the config as detailed in the documentation, in Umbraco:CMS:Content.
  • The LoginBackgroundImage and LoginLogoImage and LoginLogoImageAlternative are according to the documentation “relative to the wwwroot/umbraco path“. So in other words: your images need to be in wwwroot/umbraco or a subfolder to work.

This is my login screen in Umbraco 16.3.4:

The appSettings.json:

{
	"$schema": "appsettings-schema.json",
	"Umbraco": {
		"CMS": {
			...
			"Content": {
				...
				"LoginBackgroundImage": "assets/img/proudnerds-background.jpg",
				"LoginLogoImage": "assets/img/application/Proud-Nerds-logo-RGB-wit.svg"
				...
			}
		}
	}
}

The images are located here:

2 Likes

My paths are all relative, it’s the same format as several other sites running <v16. Only thing I can see is that the three images (/umbraco/management/api/v1/security/back-office/graphics/login-logo etc…) come back as a 404. Not sure if that causes this or not.

if i move the images to wwwroot/umbraco/login_images/… they work fine but in older versions I could just target the media folder. I guess more of a feature request really, that and just putting the images in the plugin’s folder

Looks like here’s your blocker…

I do this on Umbraco 16 - works fine. Do the exact same on the latest 17 version and it is not working.

It ignores appsettings and only defaults to:
/umbraco/management/api/v1/security/back-office/graphics/login-background
/umbraco/management/api/v1/security/back-office/graphics/login-logo
/umbraco/management/api/v1/security/back-office/graphics/login-logo-alternative

Run and new install of Umbraco and no wwwroot/umbraco folder is made either and these do not have file extensions either.

It’s an API endpoint that reads the config

Which is why you aren’t seeing it change. I also think it has to read from wwwroot/ at least my are working from there. Not sure it works with the file provider for media I haven’t tested.

As I noted. It is not working for me on 17. 16 it does.

  1. Fresh installed 17 - those paths (/umbraco/management/api/v1/security/back-office/graphics/login-background) are what are output and no images loaded.
  2. Add custom images, correct paths and appsettings values - not changed.
  3. There is a method that worked in 13 that I adapted to work in later versions to read from node media picker data that another Umbraco developer originally made and documented based on something Paul originally did. - Does not work either.

The issue is something is stuck and I have done multiple fresh 17 builds and can not get it to work. The fact that the appsettings is not read and how it is not even doing what it used to with wwwroot/umbraco media folder images –Something seems wrong.

what path are you using?

These work for me

        "LoginBackgroundImage": "../media/zdqkdyk1/reddick.jpg",
        "LoginLogoImage": "../assets/wizard.webp",

The LoginBackgroundImage, LoginLogoImage, and LoginLogoImageAlternative are referenced from the /wwwroot/umbraco/ folder.

Are you sure that you are using the correct folder?

Hi Luuk.

  1. The default Umbraco output is what ever it is you do not control it
  2. You can specify any path you want when adding into the appsettings your pathing inside wwwroot

Does not matter what I put in. Like I mentioned it is fine in Umbraco 16 but I can not create any Umbraco 17 where any of this works currently.

What does your app settings look like? It is working ok for me

Looks like it is relative to the SystemDirectories.Umbraco folder in v17???

 private IActionResult HandleFileRequest(string virtualPath)
    {
        var filePath = $"{Constants.SystemDirectories.Umbraco}/{virtualPath}".TrimStart(Constants.CharArrays.Tilde);

...
}
        /// <summary>
        ///     The Umbraco folder that exists at the content root.
        /// </summary>
        /// <remarks>
        ///     This is not the same as the Umbraco web folder which is configurable for serving front-end files.
        /// </remarks>
        public const string Umbraco = "~/umbraco";

according to docs
The LoginBackgroundImage, LoginLogoImage, and LoginLogoImageAlternative are referenced from the /wwwroot/umbraco/ folder.

which is why I use ../ in mine to jump into wwroot

Seems to work without issue for me (17.2.1).. from wwwroot/umbraco/....

1 Like

As I mentioned, I have other sites with custom images in different folder paths and they work find.

If you look at the issue I posted it is not picking it up in the JSOn and giving a 404 not found. It is randmly doing an API path for the images regardless.

"LoginBackgroundImage": "/assets/login/login.png",
"LoginLogoImage": "/assets/login/logo.png",
"LoginLogoImageAlternative": "/assets/login/logo.png",

Noting I have the exact same on another site and it works.

This works.
It looks inside /umbraco.
I have Umbraco 16, 15 and 14 sites where it is in wwwroot but not n the umbraco folder.

The documentation does state:

The LoginBackgroundImage, LoginLogoImage, and LoginLogoImageAlternative are referenced from the /wwwroot/umbraco/ folder.

But the code example above it indicates you can put it where you want along with other statements.

So if it is a core change while the documentation has been updated partially from what I can see from previous versions, it needs to be tweaked a bit more to be clear.

UPDATE:

Ok :frowning:
I thought I had this sorted this but while it works on localhost in a staging or production it still does not seem to work. This is really odd.

UPDATE 2:

Ok. Getting closer.

The API endpoints are always there. The code for these fetches the default images and loads them and if appsettings exist tries to use those.

The API endpoints are ALWAYS what are there regardless, the code loads the images.

  • The default loads correctly as is.

  • If you have Appsettings values and the path is not correct the custom logic does not render anything - I think this should have a fallback to use defaults if images are 404 here.

  • On a localhost build I can set images under /umbraco with…. “foldername/image.png”
    OR I can load images outisde of the /umbraco folder so by setting the path… “/foldername/image.png”

As soon as I apply this to a compiled solution on UAT, Staging or Production site running in IIS though Neither of these work.

Removing the appsettings completly…

  • Localhost - default loaded
  • UAT and staging - Not working
  • Production - Not working

So there is something going on here.

UPDATE 3:
“./loginimages/login.png” so ./ Will also work on localhost where the image is in wwwroot/loginimages folder.

On a build path it creates:

…. /wwwroot/umbraco/management/api/v1/security/back-office/graphics/login-background.png

It makes this pathing on the build solutions but this is not working.

Hi Liam,

Not sure what to suggest since it is working as expected for me both locally and in production.

One question, when you publish your site, is it definitely including your image files?

I had to use the path: “../umbraco/assets/img/login.jpg” for example and it worked.