Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattpiwik <matthieu.aubry@gmail.com>2011-03-29 06:16:08 +0400
committermattpiwik <matthieu.aubry@gmail.com>2011-03-29 06:16:08 +0400
commit91428bc1328abb26d1b734f01f3a7b261bf3b7e2 (patch)
treee3f81920fc6dfaa5790cfc000bc6b218eb1a1ed3 /plugins/UsersManager
parent47353af0d04ee29e3f1764ba0485968b8bde5f99 (diff)
Fixes #2236 New config setting:
; Piwik will check that usernames and password have a minimum length, and will check that characters are "allowed" ; This can be disabled, if for example you wish to import an existing User database in Piwik and your rules are less restrictive disable_checks_usernames_attributes = 0 git-svn-id: http://dev.piwik.org/svn/trunk@4225 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'plugins/UsersManager')
-rw-r--r--plugins/UsersManager/API.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/UsersManager/API.php b/plugins/UsersManager/API.php
index a9f3455ab2..2c9c7d358a 100644
--- a/plugins/UsersManager/API.php
+++ b/plugins/UsersManager/API.php
@@ -292,14 +292,16 @@ class Piwik_UsersManager_API
Piwik::checkValidLoginString($userLogin);
}
-
+
private function checkPassword($password)
{
if(!$this->isValidPasswordString($password))
{
- throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidPassword'));
+ throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidPassword'), self::PASSWORD_MIN_LENGTH, self::PASSWORD_MAX_LENGTH);
}
}
+ const PASSWORD_MIN_LENGTH = 6;
+ const PASSWORD_MAX_LENGTH = 26;
private function checkEmail($email)
{
@@ -587,6 +589,7 @@ class Piwik_UsersManager_API
throw new Exception(Piwik_TranslateException("UsersManager_ExceptionEditAnonymous"));
}
}
+
private function checkUserIsNotSuperUser( $userLogin )
{
if($userLogin == Zend_Registry::get('config')->superuser->login)
@@ -677,8 +680,13 @@ class Piwik_UsersManager_API
* @return bool
*/
private function isValidPasswordString( $input )
- {
+ {
+ if(!Piwik::isChecksEnabled()
+ && !empty($input))
+ {
+ return true;
+ }
$l = strlen($input);
- return $l >= 6 && $l <= 26;
+ return $l >= self::PASSWORD_MIN_LENGTH && $l <= self::PASSWORD_MAX_LENGTH;
}
}