I have cobbled together a member registration form. It works really well except for when I test it by entering an odd email address (ex. [email protected]). This address seems to get by the ASP.NET [Email Address] attribute (which I thought was doing a validation), but when I debug the controller I see that it fails to save the member due to an invalid email.
Model:
[Required]
[EmailAddress]
public string Email { get; set; }
Surface controller excerpt:
if (!ModelState.IsValid)
return CurrentUmbracoPage();
//member creation code
// Create new instance of "MemberService"
var memberService = Services.MemberService;
//checks to see if the newly created email is unique and has not been used before
if (memberService.GetByEmail(model.Email) != null)
{
ModelState.AddModelError("", "A member with that email already exists");
return CurrentUmbracoPage();
}
var memberShipHelper = new MembershipHelper(UmbracoContext.Current);
RegisterModel newMember = this.Members.CreateRegistrationModel("devotedDevicesMember");
newMember.Password = model.Password;
newMember.Email = model.Email;
newMember.Name = model.Name;
newMember.UsernameIsEmail = false;
newMember.Username = model.Name;
MembershipCreateStatus status = new MembershipCreateStatus();
//saves and logs new member in
memberShipHelper.RegisterMember(newMember, out status, true);
Note: it is the
status
where it returns the 'invalid email' error.
What I would like to do is either:
1-modify the email validation test that Umbraco seems to be doing when it tries to save the member; or
2 - skip the Umbraco email validation altogether and rely on the ASP.NET validation. In other words, force the email to save regardless of validity.
Member Email invalid before save
Hello,
I have cobbled together a member registration form. It works really well except for when I test it by entering an odd email address (ex. [email protected]). This address seems to get by the ASP.NET [Email Address] attribute (which I thought was doing a validation), but when I debug the controller I see that it fails to save the member due to an invalid email.
Model:
Surface controller excerpt:
Note: it is the
where it returns the 'invalid email' error.
What I would like to do is either: 1-modify the email validation test that Umbraco seems to be doing when it tries to save the member; or 2 - skip the Umbraco email validation altogether and rely on the ASP.NET validation. In other words, force the email to save regardless of validity.
Any thoughts as to how to do this?
is working on a reply...