From 5ee4c051b411f1096ff23f31a5f86dd4aada49aa Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Sun, 21 Oct 2007 17:15:37 +0000 Subject: [PATCH] isValidEmailAddr hook added to User method of that name, to allow, e.g., restricting e-mail addresses to a specific domain --- RELEASE-NOTES | 2 ++ docs/hooks.txt | 10 ++++++++-- includes/User.php | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 44734115e0..89b4acca5e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -39,6 +39,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN against the previous revision, whether currently deleted or live. * Added tooltips for the "Go" and "Search" buttons * (bug 11649) Show input form when Special:Whatlinkshere has no parameters +* isValidEmailAddr hook added to User method of that name, to allow, e.g., re- + stricting e-mail addresses to a specific domain === Bug fixes in 1.12 === diff --git a/docs/hooks.txt b/docs/hooks.txt index a7b371ee27..0212dd060f 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -516,8 +516,14 @@ after noinclude/includeonly/onlyinclude and other processing. &$text: string containing partially parsed text &$this->mStripState: Parser's internal StripState object +'isValidEmailAddr': Override the result of User::isValidEmailAddr(), for ins- +tance to return false if the domain name doesn't match your organization +$addr: The e-mail address entered by the user +&$result: Set this and return false to override the internal checks +$user: User the address is being validated for + 'isValidPassword': Override the result of User::isValidPassword() -$password: Desired password +$password: The password entered by the user &$result: Set this and return false to override the internal checks $user: User the password is being validated for @@ -745,4 +751,4 @@ $article: article object watched More hooks might be available but undocumented, you can execute -./maintenance/findhooks.php to find hidden one. \ No newline at end of file +./maintenance/findhooks.php to find hidden one. diff --git a/includes/User.php b/includes/User.php index 71307f635d..5f41c8ce7f 100644 --- a/includes/User.php +++ b/includes/User.php @@ -526,6 +526,11 @@ class User { * @return bool */ public static function isValidEmailAddr( $addr ) { + $result = null; + if( !wfRunHooks( 'isValidEmailAddr', array( $addr, &$result, $this ) ) ) { + return $result; + } + return strpos( $addr, '@' ) !== false; } -- 2.20.1