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
    17 days ago

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


    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.

    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?


  • Steve Megson 48 posts 320 karma points c-trib
    17 days ago
    Steve Megson

    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?

  • Abuabdellah | Biker | Umbracian | Freelancer |

    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
    1 week ago

    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 53 posts 158 karma points
    14 days ago
    George Phillipson

    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");
  • Warren 3 posts 73 karma points
    1 week ago

    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: