[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ocs-webserver] application/modules/default: login repair
From:       Ronald von Schlegell <null () kde ! org>
Date:       2018-09-24 12:57:17
Message-ID: E1g4QQP-000741-Ew () code ! kde ! org
[Download RAW message or body]

Git commit 6d67bc1ca0975ea2bb534baa57322a5274b37e84 by Ronald von Schlegell.
Committed on 24/09/2018 at 12:57.
Pushed by ronaldv into branch 'master'.

login repair

# Conflicts:
#	application/modules/default/models/ReviewProfileData.php
#	application/modules/default/views/scripts/rectification/change.phtml

M  +1    -1    application/modules/default/models/OAuth/Ocs.php
M  +22   -1    application/modules/default/models/ReviewProfileData.php
M  +5    -3    application/modules/default/views/scripts/rectification/change.phtml

https://commits.kde.org/ocs-webserver/6d67bc1ca0975ea2bb534baa57322a5274b37e84

diff --git a/application/modules/default/models/OAuth/Ocs.php \
b/application/modules/default/models/OAuth/Ocs.php index 612121d1..19fe9b48 100644
--- a/application/modules/default/models/OAuth/Ocs.php
+++ b/application/modules/default/models/OAuth/Ocs.php
@@ -408,7 +408,7 @@ class Default_Model_OAuth_Ocs implements \
                Default_Model_OAuth_Interface
         Zend_Registry::get('logger')->info(__METHOD__ . ' - seconds: ' . \
                $this->_db->getProfiler()->getLastQueryProfile()
                                                                                      \
->getElapsedSecs())  ;
-        $this->_db->getProfiler()->setEnabled(false);
+        $this->_db->getProfiler()->setEnabled(false); 
 
         return $resultSet;
     }
diff --git a/application/modules/default/models/ReviewProfileData.php \
b/application/modules/default/models/ReviewProfileData.php index 6917bce7..44a5efde \
                100644
--- a/application/modules/default/models/ReviewProfileData.php
+++ b/application/modules/default/models/ReviewProfileData.php
@@ -28,14 +28,17 @@ class Default_Model_ReviewProfileData
     const INVALID_USERNAME = 1;
     const INVALID_EMAIL = 2;
     
+    const INVALID_USERNAME_DEACTIVATED = 10;
     const INVALID_USERNAME_NOT_ALLOWED = 11;
     const INVALID_USERNAME_NOT_UNIQUE = 12;
     
+    const USERNAME_DEACTIVATED_TEXT = "_deactivated";
+    
 
     protected $message;
     protected $errorCode;
 
-    private $usernameValidationChain = array('isUsernameValid', 'isUsernameUnique');
+    private $usernameValidationChain = array('isUsernameDeactivated', \
                'isUsernameValid', 'isUsernameUnique');
     private $emailValidationChain = array('isEmailValid', 'isEmailUnique');
 
     /**
@@ -156,6 +159,24 @@ class Default_Model_ReviewProfileData
 
         return true;
     }
+    
+    /**
+     * @param $member_data
+     *
+     * @return bool
+     * @throws Zend_Validate_Exception
+     */
+    private function isUsernameDeactivated($member_data)
+    {
+        if (strpos($member_data->username, $this::USERNAME_DEACTIVATED_TEXT) > 0) { 
+            $this->message['username'][] = 'User is deactivated';
+            $this->errorCode = $this::INVALID_USERNAME_DEACTIVATED;
+
+            return false;
+        }
+
+        return true;
+    }
 
     /**
      * @param $member_data
diff --git a/application/modules/default/views/scripts/rectification/change.phtml \
b/application/modules/default/views/scripts/rectification/change.phtml index \
                989705a6..4d5556ad 100644
--- a/application/modules/default/views/scripts/rectification/change.phtml
+++ b/application/modules/default/views/scripts/rectification/change.phtml
@@ -38,7 +38,9 @@ $this->inlineScript()->appendFile('/theme/flatui/js/lib/bootstrap-validator.min.
  <div id="help-block" class="help-block">
                             <?php
                                 $errCode = $this->errorCode;
-                                if($errCode == \
Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_ALLOWED) { +                    \
if($errCode == Default_Model_ReviewProfileData::INVALID_USERNAME_DEACTIVATED) { +     \
print_r("Due to a switch to LDAP, there is a rare username conflict and your account \
was deactivated. Please make your username unique to continue."); +                   \
} else if($errCode == Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_ALLOWED) \
                {
                                     print_r("Some characters in your username are no \
                longer supported. Please correct it or choose another one.");
                                 } else if($errCode == \
                Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_UNIQUE) {
                                     print_r("Due to a switch to LDAP, there is a \
rare username conflict. Please make your username unique to continue."); @@ -58,8 \
+60,8 @@ $this->inlineScript()->appendFile('/theme/flatui/js/lib/bootstrap-validator.min.
                
                                 $this->form->mail->class = $this->form->mail->class \
. ' has-error';  }
                             ?>
-
-                            <?php if (($this->errorCode == \
Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_ALLOWED || $this->errorCode == \
Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_UNIQUE) ) : ?> + 
+                            <?php if (($this->errorCode == \
Default_Model_ReviewProfileData::INVALID_USERNAME_DEACTIVATED || $this->errorCode == \
Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_ALLOWED || $this->errorCode == \
Default_Model_ReviewProfileData::INVALID_USERNAME_NOT_UNIQUE) ) : ?>  <div \
class="form-group has-feedback">  <label for="username" class="control-label">The \
username has to be unique and may only contain lower case alphanumeric characters or \
single hyphens, and cannot begin or end with a hyphen</label>  <input name="username" \
id="username" value="" type="text" placeholder="Username" data-minlength="4" \
class="form-control" required data-minlength-error="Minimum of 4 characters" \
data-maxlength="40" data-maxlength-error="Maximum of 40 characters"><div \
class="help-block with-errors"></div>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic