Changeset 1042 for trunk/preferences/changepassword.php
- Timestamp:
- 06/23/09 14:27:31 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/preferences/changepassword.php
r545 r1042 20 20 include('../header.inc.php'); 21 21 22 function grava_senha_criptografada_com_certificado_no_ldap($aux_uid,$aux_senha) 23 { 24 require_once('/var/www/expresso/seguranca/classes/CertificadoB.php'); 25 $ldap_context = $GLOBALS['phpgw_info']['server']['ldap_context']; 26 $ldap_servidor = $GLOBALS['phpgw_info']['server']['ldap_host']; 27 $ldap_dn = $GLOBALS['phpgw_info']['server']['ldap_root_dn']; 28 $ldap_passwd = $GLOBALS['phpgw_info']['server']['ldap_root_pw']; 29 30 $cc=ldap_connect($ldap_servidor); 31 32 // bind .. 33 $sr=ldap_bind($cc,$ldap_dn,$ldap_passwd); 34 35 $filtro = 'uidNumber='.$aux_uid; 36 37 // Pesquisa uidNumber no LDAP 38 $sr=ldap_search($cc, $ldap_context,$filtro); 39 40 // Pega resultado .... 41 $info = ldap_get_entries($cc, $sr); 42 43 // Tem de achar só uma entrada.....ao menos uma.... 44 if($info["count"]!=1) 45 { 46 ldap_close($cc); 47 return false; 48 } 49 50 if(!$info[0]["usercertificate"][0]) 51 { 52 //Usuario sem certificado cadastrado 53 ldap_close($cc); 54 return false; 55 } 56 57 $a = new certificadoB(); 58 $R = $a->encriptar_senha($aux_senha,$info[0]["usercertificate"][0]); 59 if(!$R) 60 { 61 return false; 62 } 63 $user_info = array(); 64 $aux1 = $info[0]["dn"]; 65 $user_info['cryptpassword'] = $R; 66 ldap_modify($cc,$aux1,$user_info); 67 68 ldap_close($cc); 69 70 return true; 71 } 72 22 73 $a_passwd = $_POST['a_passwd']; 23 74 $n_passwd = $_POST['n_passwd']; … … 129 180 $GLOBALS['hook_values']['new_passwd'] = $n_passwd; 130 181 $GLOBALS['phpgw']->hooks->process('changepassword'); 182 183 if($GLOBALS['phpgw_info']['server']['certificado']) 184 { 185 if(!$GLOBALS['phpgw_info']['server']['atributousuarios'] or $GLOBALS['phpgw_info']['server']['atributousuarios'] == "person") 186 { 187 $RR = grava_senha_criptografada_com_certificado_no_ldap($GLOBALS['phpgw_info']['user']['account_id'],$n_passwd); 188 } 189 } 131 190 132 191 if ($GLOBALS['phpgw_info']['server']['use_https'] == 1)
Note: See TracChangeset
for help on using the changeset viewer.