Ignore:
Timestamp:
04/25/11 09:43:20 (13 years ago)
Author:
rafaelraymundo
Message:

Ticket #1739 - Login com certificado em atributo customizável.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.0.1/preferences/handlecertificate.php

    r3991 r4123  
    1616if($_POST['certificado']) 
    1717    { 
     18        $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Digital Certificate Registration'); 
     19        $GLOBALS['phpgw']->common->phpgw_header(); 
     20        echo parse_navbar(); 
     21        echo '<form id="answerForm" name="answerForm" method="POST" action="index.php" >'; 
     22        echo '<BR/><BR/><BR/>'; 
     23         
    1824        require_once('../security/classes/CertificadoB.php'); 
    1925        require_once('../security/classes/Verifica_Certificado.php'); 
     
    2531        if (!$c->apresentado) 
    2632            { 
    27                echo '2'.chr(0x0D).chr(0x0A).lang('Fail to get certificate'); 
    28                exit(); 
     33                echo '<div align="center"><h2>'.lang('Fail to get certificate').'</h2>'; 
     34                exit(); 
    2935            } 
    3036        $b = new Verifica_Certificado($c->dados,$cert); 
     
    3743                        $msg .= "\n" . $linha; 
    3844                   } 
    39                echo $msg; 
     45                   echo '<div align="center"><h2>'.$msg.'</h2>'; 
    4046               exit(); 
    4147            } 
     
    5460        if (!$ds) 
    5561             { 
    56                 echo '4'.chr(0x0D).chr(0x0A).lang('Failure when get user data to login'); 
     62                 echo '<div align="center"><h2>'.lang('Failure when get user data to login').'</h2>'; 
    5763                exit(); 
    5864             } 
     
    7783        if($info["count"]!=1) 
    7884            { 
    79                 echo '5'.chr(0x0D).chr(0x0A).lang('Invalid data from users directory').'('.$cert_atrib_cpf.' = ' . $c->dados['2.16.76.1.3.1']['CPF'] . ')'; 
     85                echo '<div align="center"><h2>'.lang('Invalid data from users directory').'('.$cert_atrib_cpf.' = ' . $c->dados['2.16.76.1.3.1']['CPF'] . ')'.'</h2>'; 
    8086                ldap_close($ds); 
    8187                exit(); 
    8288            } 
    83         if($info[0]["userCertificate"][0] && $cert == $info[0]["userCertificate"][0] ) 
     89            if($info[0]["uid"][0] != $GLOBALS['phpgw_info']['user']['userid']) 
     90            { 
     91                echo '<div align="center"><h2>'.lang('Invalid data from users directory').'('.$cert_atrib_cpf.' = ' . $c->dados['2.16.76.1.3.1']['CPF'] . ' - ' . $info[0]["uid"][0] . ' - ' . $GLOBALS['phpgw_info']['user']['userid'] . ')'.'</h2>'; 
     92                ldap_close($ds); 
     93                exit(); 
     94            } 
     95            if($info[0]["userCertificate"][0] && $cert == $info[0]["userCertificate"][0] ) 
    8496            { 
    8597                //echo '0'.chr(0x0D).chr(0x0A).$info[0]["uid"][0].chr(0x0D).chr(0x0A).$info[0]["cryptpassword"][0]; 
    86                 echo '6'.chr(0x0D).chr(0x0A).lang('Certificate already registered'); 
     98                echo '<div align="center"><h2>'.lang('Certificate already registered').'</h2>'; 
    8799                ldap_close($ds); 
    88100                exit(); 
     
    108120        if(!ldap_modify($ds,$aux1,$user_info)) 
    109121            { 
    110                 echo '7'.chr(0x0D).chr(0x0A).lang('Error in Certificate registration'). '  -  ' . $aux1; 
    111             } 
    112         else 
    113             { 
    114                 echo '0'.chr(0x0D).chr(0x0A).lang('To conclude your Certificate registration change your password'); 
    115             } 
     122                echo '<div align="center"><h2>'.lang('Error in Certificate registration'). '  -  ' . $aux1.'</h2>'; 
     123            } 
     124        else 
     125            { 
     126                echo '<div align="center"><h2>'.lang('To conclude your Certificate registration change your password').'</h2>'; 
     127            } 
     128 
     129            echo '<h2><img style="border:0px;margin:31px 0px 58px 0px;" src="../phpgwapi/templates/default/images/acao.gif" /></h2>'; 
     130            echo '<input type="submit" name="ok" value="' . lang('ok') . '" ></div></form>'; 
     131            $GLOBALS['phpgw']->common->phpgw_footer(); 
    116132        ldap_close($ds); 
    117133        exit(); 
     
    193209                                    </script>'; 
    194210                  echo $cod_applet; 
    195                   echo '<form method="POST" action="preferences" >'; 
     211                  echo '<form id="certificateForm" name="certificateForm" method="POST" action="handlecertificate.php" >'; 
    196212                  echo '<BR/><BR/><BR/>'; 
    197213                  echo '<div align="center"><h2>'.lang('Getting your Certificate').'</h2>'; 
    198214                  echo '<h2><img style="border:0px;margin:31px 0px 58px 0px;" src="../phpgwapi/templates/default/images/acao.gif" /></h2>'; 
    199                   echo '<input type="submit" name="cancel" value="' . lang('cancel') . '" ></div>'; 
     215                  echo '<input type="hidden" name="certificado" value="" />'; 
     216                  echo '<input type="submit" name="cancel" value="' . lang('cancel') . '" ></div></form>'; 
    200217                  $GLOBALS['phpgw']->common->phpgw_footer(); 
    201218        } 
Note: See TracChangeset for help on using the changeset viewer.