From d01fceb26cafd3a0b38c01dabe8e2173a6320d3c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 25 Oct 2013 19:27:46 +0000 Subject: [PATCH] * Admin/Preferences: changepassword hook was called twice fixed by calling in now from API and not on every location in application code changing a password --- preferences/inc/class.bopassword.inc.php | 90 ------------------------ preferences/inc/class.uipassword.inc.php | 6 -- 2 files changed, 96 deletions(-) delete mode 100644 preferences/inc/class.bopassword.inc.php diff --git a/preferences/inc/class.bopassword.inc.php b/preferences/inc/class.bopassword.inc.php deleted file mode 100644 index c5765d768b..0000000000 --- a/preferences/inc/class.bopassword.inc.php +++ /dev/null @@ -1,90 +0,0 @@ - * - * -------------------------------------------- * - * This program is free software; you can redistribute it and/or modify it * - * under the terms of the GNU General Public License as published by the * - * Free Software Foundation; either version 2 of the License, or (at your * - * option) any later version. * - \**************************************************************************/ - - /* $Id$ */ - - class bopassword - { - var $public_functions = array( - 'changepass' => True - ); - - var $xml_functions = array(); - var $xmlrpc_methods = array(); - var $soap_functions = array( - 'changepass' => array( - 'in' => array('string','string'), - 'out' => array('boolean') - ) - ); - - var $debug = False; - - function changepass($old,$new) - { - if (($ret = $GLOBALS['egw']->auth->change_password($old, $new, $GLOBALS['egw_info']['user']['account_id']))) - { - $GLOBALS['egw']->session->appsession('password','phpgwapi',base64_encode($new)); - $GLOBALS['egw_info']['user']['passwd'] = $new; - $GLOBALS['egw_info']['user']['account_lastpwd_change'] = egw_time::to('now','ts'); - accounts::cache_invalidate($GLOBALS['egw_info']['user']['account_id']); - egw::invalidate_session_cache(); - //_debug_array( $GLOBALS['egw_info']['user']); - $GLOBALS['hook_values']['account_id'] = $GLOBALS['egw_info']['user']['account_id']; - $GLOBALS['hook_values']['old_passwd'] = $old; - $GLOBALS['hook_values']['new_passwd'] = $new; - - $GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array( - 'location' => 'changepassword' - ),False,True); // called for every app now, not only enabled ones) - } - return $ret; - } - - function list_methods($_type='xmlrpc') - { - /* - This handles introspection or discovery by the logged in client, - in which case the input might be an array. The server always calls - this function to fill the server dispatch map using a string. - */ - if(is_array($_type)) - { - $_type = $_type['type'] ? $_type['type'] : $_type[0]; - } - switch($_type) - { - case 'xmlrpc': - $xml_functions = array( - 'changepass' => array( - 'function' => 'changepass', - 'signature' => array(array(xmlrpcBoolean,xmlrpcString,xmlrcpString)), - 'docstring' => lang('Change a user password by passing the old and new passwords. Returns TRUE on success, FALSE on failure.') - ), - 'list_methods' => array( - 'function' => 'list_methods', - 'signature' => array(array(xmlrpcStruct,xmlrpcString)), - 'docstring' => lang('Read this list of methods.') - ) - ); - return $xml_functions; - break; - case 'soap': - return $this->soap_functions; - break; - default: - return array(); - break; - } - } - } -?> diff --git a/preferences/inc/class.uipassword.inc.php b/preferences/inc/class.uipassword.inc.php index 59d6da24fd..e2ce1bd93f 100644 --- a/preferences/inc/class.uipassword.inc.php +++ b/preferences/inc/class.uipassword.inc.php @@ -15,12 +15,6 @@ class uipassword 'change' => True ); - function uipassword() - { - $this->bo =& CreateObject('preferences.bopassword'); - - } - function change() { //_debug_array($GLOBALS['egw_info']['user']);