This is what we have done, so it can be reused and we can register it in the web.config file. If you think about it, this is where he counts. as long as your verification and the external interface indicate to the endpoint that their username should be email and you perform the correct verification ... from there, his usual calls to any member provider support you. A new method for the abridged version and hiding / changing the original behind our facade.
public class EmailAsUsernameMembershipProvider : SqlMembershipProvider { public MembershipUser CreateUser(string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { return base.CreateUser(email, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey, out status); } private new MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { return base.CreateUser(email, password, email, passwordQuestion, passwordAnswer, isApproved, providerUserKey, out status); } public override bool RequiresUniqueEmail { get { return true; } } }
source share