Add email regular expression to Sitefinity Registration widget

500 Views Asked by At

Does anyone know how to add an email regular expression to Sitefinity's Registration Widget?

I'm new to both Sitefinity and regular expressions, but I'd like to restrict users registering to a specific email address domain during registration, with something like this:

^[\w\-\.\+]+\@\b\.\mydomain\b\.\bcom\b$

Which I think might exclude all but @mydomain.com email addresses. If that works, I need to find the right place to put it.

1

There are 1 best solutions below

0
On
  1. First download JustDecompile
  2. Decompile the Telerik.Sitefinity.Resources.dll
  3. Under the advanced setting of the Registration widget look at the "LayoutTemplatePath" field and locate that resource file in just decompile (in SF5.4 it is "Telerik.Sitefinity.Resources.Templates.Frontend.Security.RegistrationForm.ascx" might differ a bit in SF4
  4. Copy the widget code from JustDecompile
  5. Create a new .ascx in VisualStudio or your choice
  6. Add a Regex validator for the email text box
  7. Register your widget in sitefinity in the admin area

As a last alternative you could use jQuery to check that field. use `

var emRegEx = \^[\w.+-]+@mydomain\.com$\;
$("form").submit(function(){
   if(emRegEx.test($("textboxID Or Class").val())){
      $("textboxID Or Class").before("<div style='color:red;'>Email Denied</div>");
      return false;
   }
   else
   {
      return true;
   }
});