Changeset 1681 for trunk/phpgwapi/inc
- Timestamp:
- 11/19/09 13:59:58 (15 years ago)
- Location:
- trunk/phpgwapi/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/inc/class.auth_ldap.inc.php
r393 r1681 200 200 } 201 201 202 function change_password_user ($old_passwd, $new_passwd, $dn, $referrals=false) 203 { 204 //Use with RHDS 205 //system('echo "CP old_passwd: '.$old_passwd.'" >>/tmp/controle'); 206 //system('echo "CP new_passwd: '.$new_passwd.'" >>/tmp/controle'); 207 //system('echo "CP dn: '.$dn.'" >>/tmp/controle'); 208 //system('echo "CP referrals: '.$referrals.'" >>/tmp/controle'); 209 $ds=ldap_connect($GLOBALS['phpgw_info']['server']['ldap_host']); 210 if (!$ds) 211 { 212 //system('echo "CP Nao conectou no ldap" >>/tmp/controle'); 213 $this->auth_reason = ldap_errno($ldap); 214 return False; 215 } 216 else 217 { 218 if ($referrals) 219 { 220 //system('echo "CP Entrou referrals" >>/tmp/controle'); 221 $this->passwd=$old_passwd; 222 $this->dn=$dn; 223 ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); 224 ldap_set_option($ds, LDAP_OPT_REFERRALS, 1); 225 if($GLOBALS['phpgw_info']['server']['diretorioescravo']) 226 { 227 ldap_set_rebind_proc($ds, array($this, '_rebindProc')); 228 } 229 } 230 $modify["userpassword"]=$new_passwd; 231 if (!@ldap_bind($ds,$dn,$old_passwd)) 232 { 233 //system('echo "CP nao conseguiu dar bind" >>/tmp/controle'); 234 //Se a politica estiver no diretorio eh necessario tentar alterar a senha mesmo que nao haja um bind, pois a negacao de bind pode ser proveniente de uma expiracao 235 if($GLOBALS['phpgw_info']['server']['politicasenhas']=='diretorio') 236 { 237 //system('echo "CP politica eh no diretorio" >>/tmp/controle'); 238 if (!@ldap_mod_replace($ds,$dn,$modify)) 239 { 240 //system('echo "CP nao conseguiu fazer replace!" >>/tmp/controle'); 241 $this->auth_reason = ldap_errno($ds); 242 return false; 243 } 244 else 245 { 246 //system('echo "CP replace funcionou!" >>/tmp/controle'); 247 return $new_passwd; 248 } 249 } 250 $this->auth_reason = ldap_errno($ds); 251 return False; 252 } 253 else 254 { 255 //system('echo "CP Conseguiu dar bind" >>/tmp/controle'); 256 if (!ldap_mod_replace($ds,$dn,$modify)) 257 { 258 $this->auth_reason = ldap_errno($ds); 259 return False; 260 } 261 else 262 { 263 return $new_passwd; 264 } 265 } 266 } 267 } 268 269 202 270 function update_lastlogin($_account_id, $ip) 203 271 { -
trunk/phpgwapi/inc/common_functions.inc.php
r1321 r1681 685 685 686 686 /*! 687 @function personalize_include_path 688 @abstract return path to include a "ile.php" 689 @author Serpro 690 @author Antonio Carlos da SIlva 691 @discussion This function is used to generate a path with $app and $prefix paramameters. 692 @example include(personalize_include_path('phpgwapi','login'); 693 @example Will generate : /var/www/expresso/phpgwapi/templates/default/login_default.php 694 @example if "default" is the 'login_template_set' . 695 @param $app : name of application 696 @param $prefix : value to affix in login_template_set 697 */ 698 function personalize_include_path($app,$prefix) 699 { 700 $file_include = PHPGW_SERVER_ROOT . '/' . $app . '/templates/' . $GLOBALS['phpgw_info']['login_template_set'] . '/' . $prefix . '_' . $GLOBALS['phpgw_info']['login_template_set'] . '.php'; 701 if(!$file_include || !file_exists($file_include)) 702 { 703 $file_include = PHPGW_SERVER_ROOT . '/' . $app . '/templates/default/' . $prefix .'_default.php'; 704 } 705 return $file_include; 706 } 707 708 /*! 687 709 @function CreateObject 688 710 @abstract Load a class and include the class file if not done so already.
Note: See TracChangeset
for help on using the changeset viewer.