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.
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:
I have already tried to set ContinouslyUpdateXmlDiskCache and XmlContentCheckForDiskChanges to true in umbracoSettings.config.
Do you guys have any experience with this?
Hi Søren,
Did you get this to work?
I'd love to see a working sample, as I'm currently trying to implement something similar (not with multiple domains, though).
/Chriztian
Oh, thats a long time ago :)
I think I know what solution I needed it for, and looking at the source it seems like I changed the code to something like this
--
So as you can see, in stead of logging in using UmbracoContext.Security, I'm using FormsAuthentication, and then logging in with a member.
It doesn't completely fix my problem, but was enough to get the job done at that time :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.