1
0
Fork 0
mirror of https://github.com/dducret/kopano-webapp-passwd synced 2026-07-27 10:32:26 +02:00

Instead of adding a button in top bar, create a settings category to change password

some restructuring of files
This commit is contained in:
Saket Patel 2013-10-17 02:18:24 +05:30
commit 72304986fc
6 changed files with 25 additions and 237 deletions

View file

@ -44,7 +44,7 @@ class PasswdModule extends Module
$errorMessage = _('No data received.');
}
if(empty($data['username']) || empty($data['current_password']) || empty($data['new_password']) || empty($data['new_password_repeat'])) {
if(empty($data['username'])) {
$errorMessage = _('User name is empty.');
}
@ -160,9 +160,9 @@ class PasswdModule extends Module
$passwd = $data['new_password'];
$passwdRepeat = $data['new_password_repeat'];
$passwd_cmd = "/usr/bin/zarafa-passwd -u %s -o %s -p %s";
if($this->checkPasswordStrenth($passwd)) {
$passwd_cmd = "/usr/bin/zarafa-passwd -u %s -o %s -p %s";
// all information correct, change password
$cmd = sprintf($passwd_cmd, $data['username'], $data['current_password'], $passwd);
exec($cmd, $arrayout, $retval);
@ -176,7 +176,7 @@ class PasswdModule extends Module
));
} else {
$errorMessage = _('Password is not changed.');
}
}
} else {
$errorMessage = _('Password is weak.');
}
@ -203,6 +203,7 @@ class PasswdModule extends Module
*/
public function checkPasswordStrenth($password)
{
return true;
// @FIXME should be moved to client side
if (preg_match("#.*^(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).*$#", $password)) {
return true;