Copied to clipboard

Flag this post as spam?

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


  • Jonas 8 posts 78 karma points
    May 16, 2018 @ 09:04
    Jonas
    0

    Can not publish after upgrade to 7.10.4

    Hi,

    I've upgraded the CMS from version 7.4.1 to version 7.10.3 and 7.10.4. The problem occurs in both versions.

    When I'm trying to publish some changes to a page I get an error message saying 'username cannot be null or whitespace'. Tried to log in and out, different browsers, but no luck. Restored config-files, did not help.

    Posted this in a similar thread, but since it's resolved it will probably be missed. Posted the Stacktrace in my previous question.

    Any one got any ideas?

  • Jonas 8 posts 78 karma points
    Jun 14, 2018 @ 10:46
    Jonas
    0

    Bump

  • Richard Eyres 98 posts 580 karma points
    Jun 14, 2018 @ 10:53
    Richard Eyres
    0

    Hello

    It sounds like the user you are using does not have a username. I take it you have checked all your users to make sure they are correct? I know the users section was upgrade in a version between your two versions, so maybe something is not right there.

    I have upgraded a couple of sites of similar versions, and have not encountered this issue, so i can not provide any more information/help.

  • Jonas 8 posts 78 karma points
    Jun 14, 2018 @ 11:21
    Jonas
    0

    Hi Richard,

    I've checked the old and upgraded db and userName isn't empty in any of them. Created a new user but got the same error with that.

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Jun 14, 2018 @ 10:58
    Dan Diplo
    0

    This is just a guess, but in the more recent versions of Umbraco there is a new setting that defaults to member usernames being the email address. Most old Umbraco sites probably have the username as the login name for members, but if you don't change this setting then it may be confusing Umbraco.

    So I would check /config/umbracoSettings.config

    Look within the <security> section.

    Ensure you have the following within there:

    <usernameIsEmail>false</usernameIsEmail>
    

    (If it's not there, create it).

    You can compare your current config to the default one in 7.10.4 to ensure you have merged all changes. A good diff tools is handy for this! Same goes for all config files.

    I'm not saying this will fix the issue, just something to try.

    I'd also clear all your cookies for the site, too, or try logging in via an incognito window.

  • Jonas 8 posts 78 karma points
    Jun 14, 2018 @ 11:52
    Jonas
    0

    Hi Dan,

    I added the configuration, but got the same error with both true and false. Changed the username to the email, but no difference. Tried incognito mode in different browsers with the same result. There was no change in the /config/umbracoSettings.config during the upgrade.

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    Jun 14, 2018 @ 12:28
    Michael Latouche
    0

    Hi Jonas,

    Just a thought because I have no idea what changed between those versions, but could it be that it is some kind of database constraint/foreign-key issue?

    Something like a link to a "published by/ created by/edited by" field that could previously be empty, and not anymore? So when you load it it's OK, but when you try to save/publish it, then it sees the field is empty and starts complaining...

    Cheers,

    Michaël.

  • Jonas 8 posts 78 karma points
    Jun 14, 2018 @ 13:18
    Jonas
    0

    Hi Michaël,

    The problem occurs in the backoffice when I press the save and publish button, and a call is made to to /umbraco/backoffice/UmbracoApi/Content/PostSave

    When I debug, however, System.Web.HttpContext.Current.User.Identity.Name is empty, but that occurs in new and old version. But I'll dig more in this.

  • Jonas 8 posts 78 karma points
    Jun 15, 2018 @ 10:39
    Jonas
    0

    I'm getting confused, I log in to the backoffice with one user. Browsing to a page on the site and my user is unknown. Checked these:

    var uh = new UmbracoHelper(UmbracoContext);
    var sim = OwinContext.GetBackOfficeSignInManager();
    
    var cu = UmbracoContext.Security.CurrentUser; //null
    var uin = System.Web.HttpContext.Current.User.Identity.Name; //""
    var n = uh.MembershipHelper.CurrentUserName; //""
    var amName = sim.AuthenticationManager.User.Identity.Name; //""
    

    Tested with:

    var signInStatus = sim.PasswordSignInAsync("user", "password", false, false).Result;
    var cu2 = UmbracoContext.Security.CurrentUser;//null
    var uin2 = System.Web.HttpContext.Current.User.Identity.Name;//"user"
    var amName2 = sim.AuthenticationManager.User.Identity.Name;//"user
    var n2 = uh.MembershipHelper.CurrentUserName;//"user"
    

    If I reload the backoffice I'm the new user, but on the site I'm still unknown. But I can still not publish a page.

    Any ideas?

  • Jonas 8 posts 78 karma points
    Jun 25, 2018 @ 10:03
    Jonas
    0

    I noticed that the content is saved and "marked to be published". If I leave the page I get "You have unsaved changed" dialog, but when I choose discard my changes are saved. And if I recycle the app pool my changes are published and the history have a username. So for some reason doesn't the context know my user, when I'm trying to save and or publish, but at the same time adding to the history works fine.

    I looked in the Umbraco.Web.Editors.ContentController and it seems to have many checks on the current user, but according to my debugging those should fail before the save.

    Or am I missing any steps there that makes all this clear?

Please Sign in or register to post replies

Write your reply to:

Draft