mirror of
https://github.com/silentsakky/zarafa-webapp-passwd
synced 2026-07-27 18:41:08 +02:00
parent
d2dd91cfe5
commit
772f56513e
2 changed files with 28 additions and 10 deletions
10
README.md
10
README.md
|
|
@ -3,11 +3,11 @@ zarafa-webapp-passwd
|
|||
|
||||
The Passwd plugin allows the user to change his password inside of WebApp.
|
||||
|
||||
This plugin is largely based on the "Passwd" plugin by Andreas Brodowski.
|
||||
This plugin is largely based on the Passwd plugin by Andreas Brodowski.
|
||||
For his original work check this [link](https://community.zarafa.com/pg/plugins/project/157/developer/dw2412/passwd-plugin)
|
||||
|
||||
## How to install
|
||||
1. If you want to use this plugin with production / debug version of webapp then please download package from [community](__link_to_come__)
|
||||
1. If you want to use this plugin with production / debug version of webapp then please download package from [community](https://community.zarafa.com/pg/plugins/project/23147/developer/silentsakky/webapp-password-change)
|
||||
2. If you want to use this plugin with source copy of webapp then you can just download this whole project
|
||||
3. Extract contents of this plugin to <webapp_path>/plugins directory
|
||||
4. Give read permissions to apache for <webapp_path>/plugins/passwd directory
|
||||
|
|
@ -31,8 +31,8 @@ For his original work check this [link](https://community.zarafa.com/pg/plugins/
|
|||
|
||||
## Notes
|
||||
- Feedback/Bug Reports are welcome
|
||||
- if anyone is good at creating icons then please help me add a good icon to change password tab (credits will be given)
|
||||
- If anyone is good at creating icons then please help me add a good icon to change password tab (credits will be given)
|
||||
|
||||
## Todo
|
||||
- add password strength meter on client side, so user can create complex passwords
|
||||
- check on client side for empty fields
|
||||
- Add password strength meter on client side, so user can create complex passwords
|
||||
- Check on client side for empty fields
|
||||
|
|
@ -89,12 +89,16 @@ class PasswdModule extends Module
|
|||
|
||||
// check connection is successfull
|
||||
if(ldap_errno($ldapconn) === 0) {
|
||||
// get the users uid, if we have a multi tenant installation then remove company name from user name
|
||||
$parts = explode('@', $data['username']);
|
||||
$uid = $parts[0];
|
||||
|
||||
// search for the user dn that will be used to do login into LDAP
|
||||
$userdn = ldap_search (
|
||||
$ldapconn, // connection-identify
|
||||
PLUGIN_PASSWD_LDAP_BASEDN, // basedn
|
||||
"uid=".$uid, // search filter
|
||||
array("dn") // needed attributes. we need the dn
|
||||
'uid=' . $uid, // search filter
|
||||
array('dn') // needed attributes. we need the dn
|
||||
);
|
||||
|
||||
if ($userdn) {
|
||||
|
|
@ -102,7 +106,7 @@ class PasswdModule extends Module
|
|||
$userdn = $userdn[0]['dn'];
|
||||
|
||||
// bind to ldap directory
|
||||
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
|
||||
|
||||
// login with current password if that fails then current password is wrong
|
||||
$bind = ldap_bind($ladpconn, $userdn, $data['current_password']);
|
||||
|
|
@ -117,6 +121,13 @@ class PasswdModule extends Module
|
|||
$return_mod = ldap_modify($ldapconn, $userdn, $entry);
|
||||
if (ldap_errno($ldapconn) === 0) {
|
||||
// password changed successfully
|
||||
|
||||
// write new password to session because we don't want user to re-authenticate
|
||||
session_start();
|
||||
$_SESSION['password'] = $passwd;
|
||||
session_write_close();
|
||||
|
||||
// send feedback to client
|
||||
$this->sendFeedback(true, array(
|
||||
'info' => array(
|
||||
'display_message' => _('Password is changed successfully.')
|
||||
|
|
@ -161,7 +172,7 @@ class PasswdModule extends Module
|
|||
$passwdRepeat = $data['new_password_repeat'];
|
||||
|
||||
if($this->checkPasswordStrenth($passwd)) {
|
||||
$passwd_cmd = "/usr/bin/zarafa-passwd -u %s -o %s -p %s";
|
||||
$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);
|
||||
|
|
@ -169,6 +180,13 @@ class PasswdModule extends Module
|
|||
|
||||
if ($retval === 0) {
|
||||
// password changed successfully
|
||||
|
||||
// write new password to session because we don't want user to re-authenticate
|
||||
session_start();
|
||||
$_SESSION['password'] = $passwd;
|
||||
session_write_close();
|
||||
|
||||
// send feedback to client
|
||||
$this->sendFeedback(true, array(
|
||||
'info' => array(
|
||||
'display_message' => _('Password is changed successfully.')
|
||||
|
|
@ -222,7 +240,7 @@ class PasswdModule extends Module
|
|||
$salt .= substr('0123456789abcdef', rand(0, 15), 1);
|
||||
}
|
||||
|
||||
$hash = '{SSHA}' . base64_encode(pack("H*",sha1($text . $salt)) . $salt);
|
||||
$hash = '{SSHA}' . base64_encode(pack('H*',sha1($text . $salt)) . $salt);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue