Copied to clipboard

Flag this post as spam?

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


  • Tom Engan 430 posts 1173 karma points
    Jul 21, 2017 @ 11:59
    Tom Engan
    0

    if (Members.Login(model.Username, model.Password)) - true before, now false

    I have created a Surfacecontroller using the following method:

    // Umbracos own built-in loginmodel is used
    public ActionResult Login(Umbraco.Web.Models.LoginModel model)
    {
        if (model.Username == null)
            ModelState.AddModelError("", "Brukernavn må fylles ut");
    
        if (model.Password == null)
            ModelState.AddModelError("", "Passord må fylles ut");
    
        if (Members.Login(model.Username, model.Password))      << Redirect to turmaal if true.
            return Redirect("/turmaal");
    
        ModelState.AddModelError("", "Ugyldig innlogging");
        return CurrentUmbracoPage();                            << Redirect to current page if false.
    }
    

    After I had problems with my older site upgraded evenly from long time ago, up to Umbraco ver 7.6.2, I've now created a whole new site with Umbraco ver 7.6.4.

    I've saved a member with the same username and password, but if (Members.Login (model.Username, model.Password)) is now false and not true as before (will now not redirect to "/turmaal" as before).

    I can't longer log me in as a authenticated Member. I've tried Members.IsLoggedIn(), but this give me false too.

    Someone who knows where the difference on these two site can be?

    Assuming there's a setting that needs to be checked, but which?

  • Micha Somers 134 posts 597 karma points
    Jul 22, 2017 @ 07:44
    Micha Somers
    100

    Hi Tom,

    Did you copy member data from the database of the "old" Umbraco version to the database of the new fresh install?

    If yes, can you check your UmbracoMembershipProvider in web.config?

    Fresh installs will have:

    minRequiredPasswordLength="10" useLegacyEncoding="false"
    

    But when using member data from a version before 7.6 the password hashing is based on another algoritm where it's likely that you need to use:

    useLegacyEncoding="true"
    

    And in case the length of the members passwords could have been smaller than 10, also change the value for minRequiredPasswordLength to match the minimum length used.

  • Tom Engan 430 posts 1173 karma points
    Jul 24, 2017 @ 09:29
    Tom Engan
    1

    Thank you for the answer. That was the solution. I forgot to mention that I'm using SQL Compact Edition, so it's a new database and creation of new members.

    I changed myRequiredPasswordLength to what I had before, but I think I changed useLegacyEncoding to true before creation of new members. When I deleted all test members, changed useLegacyEncoding to false again, created new members, and members can now log in as in the previous solution. :-)

Please Sign in or register to post replies

Write your reply to:

Draft