Copied to clipboard

Flag this post as spam?

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


  • Warren 3 posts 73 karma points
    Sep 06, 2019 @ 13:08
    Warren
    0

    MembershipHelper login function "The input is not a valid Base-64 string" problems?

    Hi,

    This might be something simple that I'm just missing, but I'm trying to login a member through a form where their username is their email, e.g. test@google.com.

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

    This function crashes with the error "The input is not a valid Base-64 string as it contains a non-base 64 character". I think maybe because of the @ symbol in the email address.

    I've seen examples of email being used as usernames, for example in this Umbraco TV video, so I'm wondering what I'm doing wrong or if this just isn't allowed in v8?

    Thanks!

  • Steve Megson 120 posts 733 karma points c-trib
    Sep 06, 2019 @ 15:03
    Steve Megson
    0

    The invalid string will be what's stored in the Password column of cmsMember, rather than the email address. Is this a brand new v8 site, or one upgraded from v7?

  • Sep 07, 2019 @ 12:28
    Abuabdellah | Biker | Umbracian | Freelancer | PPH.me/abuabdellah
    0

    Warren, peace be upon those who follow guidance.

    Based on your post I think you're using V8, I see that you may encountered an issue of commands order which seems duplicated topic.

    I suggest to visit the following:

    1. Topic 1
    2. Topic 2
  • Warren 3 posts 73 karma points
    Sep 09, 2019 @ 08:00
    Warren
    0

    Thank you for linking me to these topics. I changed the order to what is suggested in these threads and it seems to be working alright.

    Although even before I changed the order, what I was doing wasn't very consistent in creating the error. Sometimes it would be fine, sometimes it would throw the error. But for now I can't recreate it again so I'll see how it goes. Thanks!

  • George Phillipson 61 posts 176 karma points
    Sep 08, 2019 @ 18:46
    George Phillipson
    0

    When setting up a new member in V8 below is the create member save order and it works OK.

    var memberService = Services.MemberService;
    var member = memberService.CreateMemberWithIdentity(model.UserName, model.Email, $"{model.FirstName} {model.LastName}", "member");
    
                    member.SetValue("firstName", model.FirstName);
                    member.SetValue("lastName", model.LastName);
                    member.SetValue("address", model.Address);
                    member.SetValue("city", model.City);
                    member.SetValue("county", model.County);
                    member.SetValue("postCode", model.PostCode);
                    member.SetValue("whatsAppNumber", model.MobileNumber);
                    member.SetValue("membersPoints", 0);
                    member.SetValue("agreeToTerms", model.AgreeToTerms);
                    member.SetValue("membershipStartDate", DateTime.Now.ToString("dd/MMM/yyyy HH:mm"));
                    member.IsApproved = false;
    
                    memberService.SavePassword(member, model.Password);
    
                    memberService.AssignRole(member.Id, "Bronze");
    
                    memberService.Save(member);
    
  • Warren 3 posts 73 karma points
    Sep 09, 2019 @ 08:32
    Warren
    0

    Yeah this works for me most of the time, but as I said in the response above sometimes doing things in this order throws the error, sometimes it doesn't.

    It seems like saving the member then saving the password is the recommended order, and for me doing it that way so far hasn't called any issues.

Please Sign in or register to post replies

Write your reply to:

Draft