Copied to clipboard

Flag this post as spam?

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


  • Aristotelis Pitaridis 84 posts 402 karma points
    Aug 02, 2014 @ 09:15
    Aristotelis Pitaridis
    0

    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. 

    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.

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 02, 2014 @ 10:47
    Dennis Aaen
    0

    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

  • Aristotelis Pitaridis 84 posts 402 karma points
    Aug 02, 2014 @ 13:34
    Aristotelis Pitaridis
    0

    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

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Aug 03, 2014 @ 18:14
    Dennis Aaen
    0

    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

  • Aristotelis Pitaridis 84 posts 402 karma points
    Aug 03, 2014 @ 20:33
    Aristotelis Pitaridis
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft