]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
disallow login for users without validated email
authorEvan Prodromou <evan@status.net>
Mon, 21 Feb 2011 21:20:10 +0000 (16:20 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 21 Feb 2011 21:20:10 +0000 (16:20 -0500)
plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php

index 980b7beb6e3f9fd362c36da0f97c912eb724d05b..ad6503e0b72804961dc4fc346eda27db5df458ee 100644 (file)
@@ -24,6 +24,8 @@
  * @package   StatusNet
  * @author    Craig Andrews <candrews@integralblue.com>
  * @author    Brion Vibber <brion@status.net>
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2011 StatusNet Inc. http://status.net/
  * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
@@ -75,6 +77,12 @@ class RequireValidatedEmailPlugin extends Plugin
 
     public $trustedOpenIDs = array();
 
+    /**
+     * Whether or not to disallow login for unvalidated users.
+     */
+
+    public $disallowLogin = false;
+
     /**
      * Event handler for notice saves; rejects the notice
      * if user's address isn't validated.
@@ -246,7 +254,8 @@ class RequireValidatedEmailPlugin extends Plugin
      */
     function onUserRightsCheck(Profile $profile, $right, &$result)
     {
-        if ($right == Right::CREATEGROUP) {
+        if ($right == Right::CREATEGROUP ||
+            ($this->disallowLogin && ($right == Right::WEBLOGIN || $right == Right::API))) {
             $user = User::staticGet('id', $profile->id);
             if ($user && !$this->validated($user)) {
                 $result = false;