So that page shouldn't be visible in the navigation, when you are not logged in. The user can login at the bottom of page: http://ak-security.dk/aktuelt/nyheder.aspx , but after I log out, it doesn't seem to log out correctly, because when I click at the menu item "Akuelt" a couple of times I shows that the user still is logged in?
This behavior is probably related to this bug where users don't get signed "all the way" out. I believe it's been fixed for 4.7.1. In the comments of that link there is a workaround where you can add some extra code to your Logout button to completely logoff the member. I think you'll need to implement your logout in a C# usercontrol though to add this code, if you are not already.
I think you'd need to download the source from that (or a later changeset), compile it, and copy over bin, umbraco, umbraco_client. Or you could try nightly.umbraco.org and download the latest compiled 4.7.1 and do the same. There could of course be other ramifications of doing this since 4.7.1 isn't finalized yet, but it will probably work. Of course make sure to backup your entire site first :)
Or use the workaround described in the comments of the workitem, works for me :)
I'm sure I'm doing it right, cause when I build the project without any changes and replace the usercontrol and dll-file a get a assembly error: http://ak-security.dk/forside.aspx
- Compile your changes - Copy the /bin/AmplusCorp.uLogin.dll file from your compiled project to /bin/ on your website - Copy the uLogin.ascx file from your project to /usercontrols/AmplusCorp/ - No need to copy the ascx.cs file
I use Visual Web Developer 2010 Express, so I choose Debug > Build uLogin (project name) ... the dll is just called uLogin.dll so a rename it to AmplusCorp.uLogin.dll and replace it .. and the same with the usercontrols..
but it shows the error even when no changes are made?
Ah ok, it looks like the DLL in the original package file was named AmplusCorp.uLogin.dll, but in the source version it's just uLogin.dll
So try deleting the original AmplusCorp.uLogin from your website's /bin/ folder, make sure you copied the files above over, and it should (hopefully) start working.
That was better.. it doens't like if you rename the file afterwards. Or perhaps the dll file and usercontrols should have same name..
It works with when I don't rename the files and upload the ulogin.dll and ulogin.ascx files. And it seems to log out correctly, when I use the ulogin log out button on same page as the login control and then it also hide one of the menu item on left here http://ak-security.dk/aktuelt/nyheder.aspxas it should be.
uLogin isn't a asp:Login control, it's a usercontrol that does all the "wiring up" of the login process manually.
I guess you are still having the bug if you use the logout button at the bottom? You'll need the code you added to DoLogout to execute to properly log out until the bug is fixed in Umbraco. So one thing you could do is replace your Logout button/control with an XSLT macro - you can use umbraco.library:IsLoggedOn() to show different output for each case.
The Logout button could link to your page where the uLogin macro is and the user can click Logout from there. If you wanted to save the user a click, you could even have the link goto your uLogin page with something like ?logout=1 at the end, then check for that in the uLogin code and call DoLogout() manually.
Yes, the uLogin log out button works... but not the one I use at the bottom.. But perhaps I can use DoLogout to the LoginStatus if I create it as a usercontrol..
Okay.. I finally think I got it working, as it normal should works :)
I have used the uLogin control for login control, with a little bit modification... and the I have a LoginStatus control at the bottom of page. I then use the DoLogOut for that control also:
using umbraco; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.member; ... protected void Page_Load(object sender, EventArgs e)
{
}
protected void DoLogout()
{
int memberID = umbraco.cms.businesslogic.member.Member.CurrentMemberId();
umbraco.cms.businesslogic.member.Member.ClearMemberFromClient(memberID);
System.Web.Security.FormsAuthentication.SignOut();
Session.Abandon();
Response.Redirect(Request.RawUrl, true);
}
protected void loginstatus_LoggingOut(object sender, LoginCancelEventArgs e)
{
DoLogout();
}
Thanks for all your help Tom... I really appriciate :)
If you have your login button as a normal asp:Button it should work, it looks like you're using a LinkButton right now. Or if you want to keep it that way you could use some javascript.
Yes, I have changed the button to a LinkButton and placed a label inside (which gives a span as output) around the text.. The way I styled the button, the same way as the tabs with a span tag inside an anchor tag, so nomatter the text-length, it keep the same padding arround the text.
Okay.. I will have a look at it.. I think the asp:Button generates some javascript too at runtime.? where the LinkButton is like a normal link, but which allow to use some code in the .cs file.
Gotcha - I would try some of the links above. If a normal "form submit" from javascript doesn't work you can always use javascript to "click" the LinkButton on enter.
I will try that.. once again thank for all your help Tom :)
Nice to have solved the problem with login forms in 4.7.0 version of Umbraco.. hope it will be fixed soon.. anyway uLogin is nice to know, when working with multilingual sites and ready to use.. and easy to add modification if it's neeeded.
bool _rememberMeSet = false; ... public bool rememberMeSet
{
set
{
_rememberMeSet = value;
}
}
I think it should be used to hide the "rember me" function..
Before it was just a bool, so I changed it to a public bool, so it can be used as parameter in Umbraco. I think there need to be done some more to hide this:
I guess the LinkButton doesn't have the submit on enter as default.. but it's earsier to style as it just gives an normal anchor tag as output... and doesn't have the "down" effect as the asp:button has in IE ..
Weird login/logout problem
Hi..
I have created a page "Mine tilmeldte events", where I have set protection to that page.
http://ak-security.dk/aktuelt/nyheder.aspx
So that page shouldn't be visible in the navigation, when you are not logged in.
The user can login at the bottom of page: http://ak-security.dk/aktuelt/nyheder.aspx , but after I log out, it doesn't seem to log out correctly, because when I click at the menu item "Akuelt" a couple of times I shows that the user still is logged in?
Bjarne
Hi Bjarne,
This behavior is probably related to this bug where users don't get signed "all the way" out. I believe it's been fixed for 4.7.1. In the comments of that link there is a workaround where you can add some extra code to your Logout button to completely logoff the member. I think you'll need to implement your logout in a C# usercontrol though to add this code, if you are not already.
-Tom
It seems that this http://umbraco.codeplex.com/SourceControl/changeset/changes/cd6cf2e856d9 should fix it.. but where shall the code be placed?
Bjarne
I think you'd need to download the source from that (or a later changeset), compile it, and copy over bin, umbraco, umbraco_client. Or you could try nightly.umbraco.org and download the latest compiled 4.7.1 and do the same. There could of course be other ramifications of doing this since 4.7.1 isn't finalized yet, but it will probably work. Of course make sure to backup your entire site first :)
Or use the workaround described in the comments of the workitem, works for me :)
-Tom
Thanks..
Do you have an example of a usecontrol with the workaround and the logout button?
Bjarne
uLogin is a good start, it's a usercontrol that handles login/logout. You can add the extra code to the DoLogout() method.
-Tom
Okay..
But it don't seem to that I have access to the codebehind?
Somehow it has just created 15 copies of my eventArea.xslt file after I installed the package... weird.
Bjarne
You'll want to download the source from the Source Code tab so you can make the change, then compile and copy over the DLL.
Okay..
So I need to add this code inside the DoLogout() method?
It seems I need to do more as I'm getting some red marks.
Bjarne
Try replacing the DoLogout method with this:
I'm sure I'm doing it right, cause when I build the project without any changes and replace the usercontrol and dll-file a get a assembly error: http://ak-security.dk/forside.aspx
Hmm. These are the steps you should do:
- Compile your changes
- Copy the /bin/AmplusCorp.uLogin.dll file from your compiled project to /bin/ on your website
- Copy the uLogin.ascx file from your project to /usercontrols/AmplusCorp/
- No need to copy the ascx.cs file
-Tom
Okay..
I use Visual Web Developer 2010 Express, so I choose Debug > Build uLogin (project name) ...
the dll is just called uLogin.dll so a rename it to AmplusCorp.uLogin.dll and replace it .. and the same with the usercontrols..
but it shows the error even when no changes are made?
Bjarne
Ah ok, it looks like the DLL in the original package file was named AmplusCorp.uLogin.dll, but in the source version it's just uLogin.dll
So try deleting the original AmplusCorp.uLogin from your website's /bin/ folder, make sure you copied the files above over, and it should (hopefully) start working.
That was better.. it doens't like if you rename the file afterwards. Or perhaps the dll file and usercontrols should have same name..
It works with when I don't rename the files and upload the ulogin.dll and ulogin.ascx files.
And it seems to log out correctly, when I use the ulogin log out button on same page as the login control and then it also hide one of the menu item on left here http://ak-security.dk/aktuelt/nyheder.aspx as it should be.
But I guess I need to do something more with the log out button at bottom of the page: http://ak-security.dk/forside.aspx
It's just a LoginStatus control, which show "Medarbejder login" when you not are logged in and "Log ud" when you are logged in.
The uLogin seems just to be a <asp:net Login /> control..?
Bjarne
Glad it's working!
uLogin isn't a asp:Login control, it's a usercontrol that does all the "wiring up" of the login process manually.
I guess you are still having the bug if you use the logout button at the bottom? You'll need the code you added to DoLogout to execute to properly log out until the bug is fixed in Umbraco. So one thing you could do is replace your Logout button/control with an XSLT macro - you can use umbraco.library:IsLoggedOn() to show different output for each case.
The Logout button could link to your page where the uLogin macro is and the user can click Logout from there. If you wanted to save the user a click, you could even have the link goto your uLogin page with something like ?logout=1 at the end, then check for that in the uLogin code and call DoLogout() manually.
-Tom
Okay..
well the login control I used before was splittet up or what it's called:
Yes, the uLogin log out button works... but not the one I use at the bottom..
But perhaps I can use DoLogout to the LoginStatus if I create it as a usercontrol..
Bjarne
Okay.. I finally think I got it working, as it normal should works :)
I have used the uLogin control for login control, with a little bit modification... and the I have a LoginStatus control at the bottom of page. I then use the DoLogOut for that control also:
Thanks for all your help Tom... I really appriciate :)
Bjarne
Is it possible to activate the enter-button to login?
Like it is here on our.umbraco.org..
Right now I have to click on the login button with the mouse.
Bjarne
If you have your login button as a normal asp:Button it should work, it looks like you're using a LinkButton right now. Or if you want to keep it that way you could use some javascript.
-Tom
Yes, I have changed the button to a LinkButton and placed a label inside (which gives a span as output) around the text..
The way I styled the button, the same way as the tabs with a span tag inside an anchor tag, so nomatter the text-length, it keep the same padding arround the text.
Okay.. I will have a look at it.. I think the asp:Button generates some javascript too at runtime.? where the LinkButton is like a normal link, but which allow to use some code in the .cs file.
Bjarne
Gotcha - I would try some of the links above. If a normal "form submit" from javascript doesn't work you can always use javascript to "click" the LinkButton on enter.
I will try that.. once again thank for all your help Tom :)
Nice to have solved the problem with login forms in 4.7.0 version of Umbraco.. hope it will be fixed soon.. anyway uLogin is nice to know, when working with multilingual sites and ready to use.. and easy to add modification if it's neeeded.
Bjarne
Do you know how the rememberMeSet is used?
I don't think it does anything right now..?
I think it should be used to hide the "rember me" function..
Before it was just a bool, so I changed it to a public bool, so it can be used as parameter in Umbraco.
I think there need to be done some more to hide this:
Perhaps it is necessary to put that part inside a asp:panel to hide the paragraph too..?
Bjarne
I guess the LinkButton doesn't have the submit on enter as default.. but it's earsier to style as it just gives an normal anchor tag as output... and doesn't have the "down" effect as the asp:button has in IE ..
But as you said before, I can be fixed with some javascript and this worked for me: http://weblogs.asp.net/rternier/archive/2007/10/25/a-linkbutton-defaultbutton-updatepanel-and-firefox.aspx
Bjarne
To do logout, I created a Template with following inline Razor... and call this template from any page when user click on the Logout link..
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<umbraco:Macro runat="server" language="cshtml">
@using umbraco.cms.businesslogic.member
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
Member m = Member.GetCurrentMember();
if(m != null){
Member.RemoveMemberFromCache(m);
Member.ClearMemberFromClient(m);
}
System.Web.Security.FormsAuthentication.SignOut();
System.Web.Security.Roles.DeleteCookie();
Session.Clear();
var rootNode = Model.AncestorOrSelf(1);
Response.Redirect("/" + rootNode.Name);
}
</umbraco:Macro>
</asp:Content>
Anz,
How do you call a template from any page when a user clicks on the logout link?
Thanks.
Just add ?alttemplate=TEMPLATE NAME at the end of any url
To use this for Logout button, simply create a Link as follows
<a href="?alttemplate=logout">Logout</a>
Or simply /TEMPLATE NAME if you use extension less URLs
<a href="/logout">Logout</a>
is working on a reply...