Copied to clipboard

Flag this post as spam?

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


  • Nate 143 posts 184 karma points
    Sep 06, 2011 @ 04:59
    Nate
    0

    Membership: Allow for duplicate e-mails

    I'm using the Umbraco membership provider and I have it setup like this:

     <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="User" passwordFormat="Hashed" requiresUniqueEmail="false" />

    But when I do

     

    MembershipUser newMember = Membership.CreateUser(username, password, email);

    I get "The E-mail address is already in use."  I would think this wouldn't happen since I put requiresUniqueEmail = false.  I want to be able to create users with duplicate e-mail addresses.

    Does anyone know how to get around this problem?

     

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Sep 06, 2011 @ 09:06
    Dirk De Grave
    0

    Hi Nate,

    you're absolutely right, just checked the code and umbraco does not allow users who's email has been registered before and doesn't take into account the requiresUniqueEmail from the web.config.

    If you really need to move on with your solution and can't wait for a next release, build your own membership provider, inheriting from the umbraco membership provider and override the CreateUser() method. 

     if (Member.GetMemberFromLoginName(username) != null)
       status = MembershipCreateStatus.DuplicateUserName;
     else if (Member.GetMemberFromEmail(email) != null)
       status = MembershipCreateStatus.DuplicateEmail;

    the above snippet should be replaced with your own code so it checks the web.config settings for requiresUniqueEmail

    Log this on Codeplex please so it can be voted up and/or create a patch!

     

    Cheers,

    /Dirk

Please Sign in or register to post replies

Write your reply to:

Draft