Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Patrick van Kemenade 21 posts 132 karma points
    Feb 19, 2020 @ 09:14
    Patrick van Kemenade
    0

    Missing Culture Bug in Back-Office when trying to lookup content view first time after login Umbraco 8.5.3

    I have a very annoying issue in Umbraco 8.5.3 on my website. I have a multidomain/multilanguage website. The user I login with has his default langiuage set to en-US.

    All the content of my website is just below my homepoage and shown in a list view. When I login and click on Homepage I get an error 1150. When I change the language to for instance Spannish and then immidiatly back to English and then click Homepage all is fine and all content get's displayed.

    Looking in the log I see the following call being made when I try it for the first time after the login.

    https://localhost:<number>/umbraco/backoffice/UmbracoApi/Content/GetChildren?id=<number>&includeProperties=updateDate,owner&pageNumber=1&pageSize=100&orderBy=updateDate&orderDirection=Descending&orderBySystemField=true&filter=&cultureName=
    

    And when I open the log it says "Missing culture in mapping options."

    What catches my attention is that the parameter cultureName is empty which might by causing the error.

    Does anybody recognize this. Is there a way to make sure the culture is set after login without hgaving to change the language selection dropdown.

    Are there workarounds ? Is it smart to revert back to an older version of Umbraco ?

    And is there a guide on how to easily setup a Umbraco solution with full source code source in it so things can be debugged and I can manually fix this and other Umbraco bugs.

    Thanks for your help.

  • Patrick van Kemenade 21 posts 132 karma points
    Feb 19, 2020 @ 10:28
    Patrick van Kemenade
    100

    Note, when I first go to the front end and then to the backend by adding /umbraco to the url, the culture is also set and no issue.

    I found a workaround, but it's a bit quick and dirty, so I'm open for better solutions to this issue, anyway this is what I did.

    In \Umbraco\Js\umbraco.resources.js the call to getChildren takes place.

    I've changed the original code:

                getChildren: function getChildren(parentId, options) {
                var defaults = {
                    includeProperties: [],
                    pageSize: 0,
                    pageNumber: 0,
                    filter: '',
                    orderDirection: 'Ascending',
                    orderBy: 'SortOrder',
                    orderBySystemField: true,
                    cultureName: ''
                };
                if (options == undefined) {
                    options = {};
                }
                //overwrite the defaults if there are any specified
                angular.extend(defaults, options);
                //now copy back to the options we will use
                options = defaults;
    

    To this, injecting a default value in case it's missing (the first time), not perfect because if I have a user who's default language is Spannish he will get English the first fime, but still better then errors:

                getChildren: function getChildren(parentId, options) {
                var defaults = {
                    includeProperties: [],
                    pageSize: 0,
                    pageNumber: 0,
                    filter: '',
                    orderDirection: 'Ascending',
                    orderBy: 'SortOrder',
                    orderBySystemField: true,
                    cultureName: 'en-US'
                };
                if (options == undefined) {
                    options = {};
                }
                //overwrite the defaults if there are any specified
                angular.extend(defaults, options);
                //now copy back to the options we will use
                options = defaults;
    
                if (options.cultureName==null) {
                    options.cultureName = 'en-US';
                }
    

    Hope this helps anyone, still open for better solutions or workaround, or explanation why this issue happens in the first place.

    Also is there an easy way to hook into and override the after login event, where I can read the default language of the user and immediately set the culture.

  • Sebastiaan Janssen 4876 posts 14511 karma points MVP admin hq
    Feb 19, 2020 @ 10:38
    Sebastiaan Janssen
    0

    This seems closely related to the issue over here: https://github.com/umbraco/Umbraco-CMS/issues/7674

    I believe the default language for a user only determines the localization for the backoffice, not which language variant is selected by default.

    We are working on adding permissions for editable languages per user, would make sense that the first selected language there would be the default language the user starts editing with.

    But in any case, right now, you should not get errors, the default language should be selected after login.

  • Sebastiaan Janssen 4876 posts 14511 karma points MVP admin hq
    Feb 19, 2020 @ 10:52
    Sebastiaan Janssen
    1

    That said, I don't know how to reproduce your issue, I have a multilingual list view as my first root node, my user is en-US, I logged in using a private browsing window, so no cookies layinf around, I don't seem to get the error you're getting

    enter image description here

  • Patrick van Kemenade 21 posts 132 karma points
    Feb 19, 2020 @ 11:39
    Patrick van Kemenade
    0

    Hello Sebastian,

    Thanks for your reply, I have 2 seperate different multilingual websites with distinct database (both Umbraco 8.5.3) and I have this issue on both of them, so I think this is a general Umbraco issues.

    The way to reproduce it for me is to login goto homepage, if things are showing up normally press Logout, Login again, you'll be send directly to the homepage, click on it -> boommmm

    If I visit the frontend first or even refreshing the page after the crash will fix the issue for the rest of the session. But that's not something I could tell a customer to just ignore error and press refresh.

    Regards, Patrick

  • Sebastiaan Janssen 4876 posts 14511 karma points MVP admin hq
    Feb 19, 2020 @ 14:14
    Sebastiaan Janssen
    0

    Weirdly, you can't see it in the gif above, but before I logged out I was on the home page (the list view page called "Listy"). But each time I log in again I end up on the dashboard instead of on the home page. Which is probably why I don't see the error?

  • Nik 1218 posts 5081 karma points MVP 2x c-trib
    Feb 19, 2020 @ 16:19
    Nik
    0

    Ohh, this issue might crop up if your "auto-logout" timeout triggers Seb. As when you log back in it restores you to exactly where you were when the logout occurs.

    Clicking the logout button doesn't remember where you were I don't believe, only the "section" so if you have dashboards then you'll see those first. Just a thought.

    Nik

Please Sign in or register to post replies

Write your reply to:

Draft