diff options
author | Brion Vibber <brion@pobox.com> | 2010-03-10 10:07:52 -0800 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-03-10 10:07:52 -0800 |
commit | 9b75e162c7002c1f29fa4ba6c1bfab7fb6b163f8 (patch) | |
tree | 048a7386747a577cc7c5106ddee080f79f80546e /plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php | |
parent | ddb656fcd2a3233b26e28987d2f3425944908d30 (diff) | |
parent | 69b2f19b6fef793aa607c6d8f4590b93e2565626 (diff) |
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php')
-rw-r--r-- | plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php index 3581f1de9..ccefa14f6 100644 --- a/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php +++ b/plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php @@ -54,13 +54,34 @@ class RequireValidatedEmailPlugin extends Plugin $user = User::staticGet('id', $notice->profile_id); if (!empty($user)) { // it's a remote notice if (!$this->validated($user)) { - throw new ClientException(_("You must validate your email address before posting.")); + throw new ClientException(_m("You must validate your email address before posting.")); } } return true; } /** + * Event handler for registration attempts; rejects the registration + * if email field is missing. + * + * @param RegisterAction $action + * @return bool hook result code + */ + function onStartRegistrationTry($action) + { + $email = $action->trimmed('email'); + + if (empty($email)) { + $action->showForm(_m('You must provide an email address to register.')); + return false; + } + + // Default form will run address format validation and reject if bad. + + return true; + } + + /** * Check if a user has a validated email address or has been * otherwise grandfathered in. * |