public abstract FindUsersByEmail ( string emailToMatch, int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection | ||
emailToMatch | string | |
pageIndex | int | |
pageSize | int | |
totalRecords | int | |
return | System.Web.Security.MembershipUserCollection |
public List <TransportMembershipUser> FindUsersByEmail(string applicationName, string emailToMatch, int pageIndex, int pageSize, out int totalRecords) { _Provider.ApplicationName = _ApplicationName; return(BuildUserList(_Provider.FindUsersByEmail(emailToMatch, pageIndex, pageSize, out totalRecords))); }
internal bool ValidateUniqueEmail(MemberSave contentItem, MembershipProvider membershipProvider, HttpActionContext actionContext) { if (contentItem == null) throw new ArgumentNullException("contentItem"); if (membershipProvider == null) throw new ArgumentNullException("membershipProvider"); if (membershipProvider.RequiresUniqueEmail == false) { return true; } int totalRecs; var existingByEmail = membershipProvider.FindUsersByEmail(contentItem.Email.Trim(), 0, int.MaxValue, out totalRecs); switch (contentItem.Action) { case ContentSaveAction.Save: //ok, we're updating the member, we need to check if they are changing their email and if so, does it exist already ? if (contentItem.PersistedContent.Email.InvariantEquals(contentItem.Email.Trim()) == false) { //they are changing their email if (existingByEmail.Cast<MembershipUser>().Select(x => x.Email) .Any(x => x.InvariantEquals(contentItem.Email.Trim()))) { //the user cannot use this email return false; } } break; case ContentSaveAction.SaveNew: //check if the user's email already exists if (existingByEmail.Cast<MembershipUser>().Select(x => x.Email) .Any(x => x.InvariantEquals(contentItem.Email.Trim()))) { //the user cannot use this email return false; } break; default: //we don't support this for members throw new HttpResponseException(HttpStatusCode.NotFound); } return true; }