Copied to clipboard

Flag this post as spam?

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


  • Toppers 31 posts 155 karma points
    Aug 07, 2016 @ 13:27
    Toppers
    0

    Unable to login using Custom login form

    I have the site up and running and I'm able login to the Dashboard using the standard interface.

    However, when I use a custom surface controller for the client-side to login (using the same username and p/w) - the following code(s) always return false:

    Membership.Provider.ValidateUser(model.Username, model.Password)
    

    as does

    Members.Login(model.Username, model.Password)
    

    Even creating a new user through the Dashboard gives the same false value!

    The values in Table umbracoUser are:

    id=0;
    userDisabled=0;
    userNoConsole=0;
    userType=1;
    failedLoginAttempts=null;
    

    Also checked the logs and this is what I'm getting

    2016-08-07 16:31:48,071 [P30252/D18/T96] WARN Umbraco.Web.UmbracoModule - Status code is 404 yet TrySkipIisCustomErrors is false - IIS will take over.

    2016-08-07 16:31:55,483 [P30252/D18/T96] INFO
    Umbraco.Core.Security.UmbracoMembershipProviderBase - Login attempt failed for username [email protected] from IP address ::1, the user does not exist

    2016-08-07 16:32:02,691 [P30252/D18/T96] INFO
    Umbraco.Core.Security.UmbracoMembershipProviderBase - Login attempt failed for username [email protected] from IP address ::1, the user does not exist

    2016-08-07 16:32:16,181 [P30252/D18/T96] INFO
    Umbraco.Web.Mvc.UmbracoPageResult - Executing Umbraco RouteDefinition controller

    2016-08-07 16:32:16,262 [P30252/D18/T96] INFO
    Umbraco.Web.Mvc.UmbracoPageResult - Finished (took 82ms)

    2016-08-07 16:32:16,600 [P30252/D18/T64] WARN
    Umbraco.Web.UmbracoModule - Status code is 404 yet TrySkipIisCustomErrors is false - IIS will take over.

    Am I using the correct methods?...

  • Sebastiaan Janssen 5045 posts 15478 karma points MVP admin hq
    Aug 07, 2016 @ 16:35
    Sebastiaan Janssen
    0

    You're trying to log in a Member.. while you're putting in the credentials of an Umbraco Backoffice User.

    I'd need to look up how to log in a User exactly, but are you sure that's what you want? The same User that you're trying to log in can go to /umbraco and do whatever you allowed them to do.

  • Dennis Öhman 32 posts 177 karma points c-trib
    Aug 07, 2016 @ 16:40
    Dennis Öhman
    0

    There are two types of authentications:

    Users = Are users in backoffice (administrator etc.) Table: umbracoUser.

    Members = Are members/user on the site Table: umbracoMember

    https://our.umbraco.org/Documentation/Getting-Started/Data/Members/

    Membership.Provider.ValidateUser and Members.Login does only validate members =)

  • Toppers 31 posts 155 karma points
    Aug 07, 2016 @ 16:44
    Toppers
    0

    Thanks guys!!

    I thought that may have been the case - so I've now created a Client Register form which will create a new member!

    Not sure if anything has changed recently as I've only used the latest version but I have the following tables:

    UmbracoUser (Populated)
    cmsMember (empty) suspect this is the problem

    BTW - I done something which I think is pretty cool with Templates and Properties - is there anywhere I can show what I've done and see if it really is cool?...

    (I've created one doc type and one template - and its used to call multiple surface controller methods)

  • Toppers 31 posts 155 karma points
    Aug 07, 2016 @ 17:18
    Toppers
    0

    Damn!!!

    I can see the table cmsMember is now populated and the following returns a value:

        var member = Membership.GetUser(model.Username);
    

    However the following is ALWAYS false so never logs in!

        if (Membership.ValidateUser(model.Username, model.Password))
    

    Do I need to encode the password or will the method automatically do it?

  • Sebastiaan Janssen 5045 posts 15478 karma points MVP admin hq
    Aug 07, 2016 @ 17:22
    Sebastiaan Janssen
    100

    How are you creating members?

    Make sure to use the MemberService: https://our.umbraco.org/Documentation/Reference/Management/Services/MemberService

    Examples are available in snippets when you create new partial views in the backoffice.

    enter image description here

  • Toppers 31 posts 155 karma points
    Aug 07, 2016 @ 17:52
    Toppers
    0

    I was trying to create server side using surface controller...

  • Sebastiaan Janssen 5045 posts 15478 karma points MVP admin hq
    Aug 07, 2016 @ 18:10
    Sebastiaan Janssen
    0

    Yes, the code is still C#, it's just an example.. :-) Use it in your controllers!

  • Toppers 31 posts 155 karma points
    Aug 07, 2016 @ 18:42
    Toppers
    0

    Excellent - got Login and Registration working!!!

    A very big Thank You!!!

Please Sign in or register to post replies

Write your reply to:

Draft