Created
January 7, 2014 13:13
-
-
Save jensp/8299103 to your computer and use it in GitHub Desktop.
Quick and dirty patch to restrict e-mail domains for registration in mahara.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lang/de.utf8/pieforms.php b/lang/de.utf8/pieforms.php | |
index 4d6ced8..03d0fee 100644 | |
--- a/lang/de.utf8/pieforms.php | |
+++ b/lang/de.utf8/pieforms.php | |
@@ -18,7 +18,7 @@ $string['element.expiry.noenddate'] = 'Kein Enddatum'; | |
$string['element.expiry.weeks'] = 'Wochen'; | |
$string['element.expiry.years'] = 'Jahre'; | |
$string['rule.before.before'] = 'Dies kann nicht nach dem Feld "%s" sein'; | |
-$string['rule.email.email'] = 'Die E-Mail Adresse ist ungültig'; | |
+$string['rule.email.email'] = 'Die E-Mail Adresse ist ungültig. Bitte beachten Sie das nur E-Mailaddressen von den Domains foo.com und baz.de zugelassen sind.'; | |
$string['rule.integer.integer'] = 'Das Feld muss eine ganze Zahl (integer) sein'; | |
$string['rule.maxlength.maxlength'] = 'Das Feld darf höchstens %d Zeichen lang sein'; | |
$string['rule.maxvalue.maxvalue'] = 'Dieser Wert kann nicht größer als %d sein'; | |
diff --git a/lang/en.utf8/pieforms.php b/lang/en.utf8/pieforms.php | |
index 972b5c3..10b93e9 100644 | |
--- a/lang/en.utf8/pieforms.php | |
+++ b/lang/en.utf8/pieforms.php | |
@@ -37,7 +37,7 @@ $string['element.color.transparent'] = 'Use theme colour'; | |
$string['rule.before.before'] = 'This cannot be after the field "%s"'; | |
-$string['rule.email.email'] = 'Email address is invalid'; | |
+$string['rule.email.email'] = 'Email address is invalid. Please consider that only addresses from the domains foo.com and baz.de are valid.'; | |
$string['rule.integer.integer'] = 'The field must be an integer'; | |
diff --git a/lib/pieforms/pieform/rules/email.php b/lib/pieforms/pieform/rules/email.php | |
index ea2afa8..60c43a6 100644 | |
--- a/lib/pieforms/pieform/rules/email.php | |
+++ b/lib/pieforms/pieform/rules/email.php | |
@@ -37,7 +37,7 @@ | |
* the address. | |
*/ | |
function pieform_rule_email(Pieform $form, $value, $element) {/*{{{*/ | |
- if (!preg_match('/^[A-Za-z0-9+\._%-]+@(?:[A-Za-z0-9-]+\.)+[a-z]{2,4}$/', $value)) { | |
+ if (!preg_match('/^[A-Za-z0-9+\._%-]+@(.*\.)?(foo\.com|baz\.de)$/', $value)) { | |
return $form->i18n('rule', 'email', 'email', $element); | |
} | |
}/*}}}*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment