* 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
This commit is contained in:
Ralf Becker 2013-10-25 19:27:46 +00:00
parent e94502515d
commit d01fceb26c
2 changed files with 0 additions and 96 deletions

View File

@ -1,90 +0,0 @@
<?php
/**************************************************************************\
* eGroupWare - preferences *
* http://www.egroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- *
* 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;
}
}
}
?>

View File

@ -15,12 +15,6 @@ class uipassword
'change' => True
);
function uipassword()
{
$this->bo =& CreateObject('preferences.bopassword');
}
function change()
{
//_debug_array($GLOBALS['egw_info']['user']);