|
|
@@ -48,6 +48,39 @@ function zimbraSingleFindAll($haystack, $needle)
|
|
|
return $values;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * server side password check
|
|
|
+ *
|
|
|
+ * recheck the client side password check
|
|
|
+ * in case that the client side check has been disabled
|
|
|
+ *
|
|
|
+ * @param string $pwd password
|
|
|
+ *
|
|
|
+ * @return string missing features or null if the password matches our needs
|
|
|
+ */
|
|
|
+function zimbraSingleCheckPassword($pwd) {
|
|
|
+ if (strlen($pwd) < 8) {
|
|
|
+ return 'Das das Passwort ist zu kurz. Es werden mind. 8 Zeichen benötigt';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!preg_match('#[0-9]+#', $pwd)) {
|
|
|
+ return 'Das Passwort muss mindestens eine Zahl enthalten';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!preg_match('#[A-Z]+#', $pwd)) {
|
|
|
+ return 'Das Passwort muss mindestens einen Grossbuchstaben (A-Z) enthalten';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!preg_match('#[a-z]+#', $pwd)) {
|
|
|
+ return 'Das Passwort muss mindestens einen Kleinbuchstaben (a-z) enthalten';
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!preg_match('#[^\w]+#', $pwd)) {
|
|
|
+ return 'Das Passwort muss mindestens ein Sonderzeichen (.,-:=) enthalten';
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Define module related meta data.
|
|
|
*
|
|
|
@@ -264,6 +297,10 @@ function zimbraSingle_UsageUpdate($params) {
|
|
|
* @return string 'success' or an error message
|
|
|
*/
|
|
|
function zimbraSingle_ChangePassword($params) {
|
|
|
+ $checkPassword = zimbraSingleCheckPassword($params['password']);
|
|
|
+ if ($checkPassword != null) {
|
|
|
+ return $checkPassword;
|
|
|
+ }
|
|
|
$api = new Zm_Auth($params['serverhostname'], $params['serverusername'], $params['serverpassword'], 'admin');
|
|
|
$login = $api->login();
|
|
|
if(is_a($login, 'Exception')) {
|