I try to create a login/logout form so that I will display different information on a page depending on if a user has loged in. The only way to validate a user that I fould in the web is the following but for some reason it always returns false.
Membership.ValidateUser("username", "password")
I use the last version of umbraco and it would be very nice if someone give me some info about how to authenticate a user.
Since you´re using Umbraco 7, you could take a look at the pre-defined Razor code snippets for a login form, and there is also a snippet that should give you the login status.
If you go to the developer section, and choose to make a parital view, or a partial view macro, you can choose to start from an empty template or use one of the pre-defined code snippets.
I have made a screenshot so it easier to see what I mean.
I used it but I have the same result like when I used the Membership.ValidateUser("username", "password") command. When I try to login it seems that the valid username and password that I use to login to the administrative page does not work. It displays the message "Invalid username or password". Should I make something else or is there any change in one of the last versions of umbraco which requires a different way of authenticating the user?
Validate user
I try to create a login/logout form so that I will display different information on a page depending on if a user has loged in. The only way to validate a user that I fould in the web is the following but for some reason it always returns false.
I use the last version of umbraco and it would be very nice if someone give me some info about how to authenticate a user.
Hi Aristotelis,
Since you´re using Umbraco 7, you could take a look at the pre-defined Razor code snippets for a login form, and there is also a snippet that should give you the login status.
When you have your login for in place you need to setup, some protection for the pages that only should be accessible when you are logged in. You can find the documentation for working with role or single based projection here: http://our.umbraco.org/wiki/reference/umbraco-client/context-menus/public-access
Hope this can help you in the right direction.
/Dennis
Thank you Dennis for your replay. Can you give me a url because I do not know wher is the page with the snippet?
Aristotelis
Hi Aristotelis,
Sorry for the little late answer.
If you go to the developer section, and choose to make a parital view, or a partial view macro, you can choose to start from an empty template or use one of the pre-defined code snippets.
I have made a screenshot so it easier to see what I mean.
Hope this helps.
/Dennis
I used it but I have the same result like when I used the Membership.ValidateUser("username", "password") command. When I try to login it seems that the valid username and password that I use to login to the administrative page does not work. It displays the message "Invalid username or password". Should I make something else or is there any change in one of the last versions of umbraco which requires a different way of authenticating the user?
Aristotelis
is working on a reply...