Frontend login for backend users

I am trying to make backend users able to log in on the frontend. It seems to be working, but not when I use multiple domains in my Umbraco install.

If I login to the backoffice at eg. domain1.com/umbraco and change a users password, then go to domain2.com/frontendlogin (eg) and use the users new password it doesn't work. If I reload (touch web.config) it works.

This is my login code:

 

    var isLoggedIn = false;
var err = "";
var us = ApplicationContext.Current.Services.UserService;

var cUser = UmbracoContext.Current.UmbracoUser;
if (Request.Form["mode"] == "login")
{
    var user = us.GetByUsername(Request.Form["user"]);
    
    if (user != null) {
        if (user.RawPasswordValue == hashPassword(Request.Form["password"]))
        {
            UmbracoContext.Security.PerformLogin(user);
            cUser = UmbracoContext.Current.UmbracoUser;
            isLoggedIn = true;
        }
        else
        {
            err = "Forkert adgangskode";
        }
    }
    else {
        err = "Forkert brugernavn";
    }
}

 

I have already tried to set ContinouslyUpdateXmlDiskCache and XmlContentCheckForDiskChanges to true in umbracoSettings.config.

 

Do you guys have any experience with this?


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/60625-frontend-login-for-backend-users