Auth
[ class tree: Auth ] [ index: Auth ] [ all elements ]

Source for file Html.php

Documentation is available at Html.php

  1. <?php
  2.  
  3. /**
  4.   * Standard Html Login form
  5.   * 
  6.   */
  7. class Auth_Frontend_Html {
  8.  
  9.     /**
  10.       * Displays the login form
  11.       *
  12.       * @param object The calling auth instance
  13.       * @return void 
  14.       */
  15.     function render(&$caller$username ''{
  16.         $loginOnClick 'return true;';
  17.         // Try To Use Challene responce
  18.         // TODO javascript might need some improvement for work on other browsers
  19.         if($caller->advancedsecurity && $caller->storage->supportsChallengeResponce() ) {
  20.             // Init the secret cookie
  21.             $caller->session['loginchallenege'md5(microtime());
  22.             //$caller->session['loginchallenege'] = '1';
  23.             #print 'Using Challenge Responce '.$caller->session['loginchallenege'].'<br/>';
  24.             print "\n";
  25.             print '<script language="JavaScript">'."\n";
  26.             // This is ugly, better sugestions send them to me
  27.             include(dirname(__FILE__).'/md5.js');
  28.             print "\n";
  29.             print ' function securePassword() { '."\n";
  30.             print '   var pass = document.getElementById(\''.$caller->getPostPasswordField().'\');'."\n";
  31.             print '   var secret = document.getElementById(\'authsecret\')'."\n";
  32.             #print '   alert(pass);alert(secret); '."\n";
  33.             // If using md5 for password storage md5 the password before 
  34.             // we hash it with the secret
  35.             #print '   alert(pass.value);';
  36.             if ($caller->storage->getCryptType(== 'md5' {
  37.                 print '   pass.value = hex_md5(pass.value); '."\n";
  38.                 #print '   alert(pass.value);';
  39.             }
  40.             print '   pass.value = hex_md5(pass.value+\''.$caller->session['loginchallenege'].'\'); '."\n";
  41.             #print '   alert(pass.value);';
  42.             print '   secret.value = 1;'."\n";
  43.             print '   var doLogin = document.getElementById(\'doLogin\')'."\n";
  44.             print '   doLogin.disabled = true;'."\n";
  45.             print '   return true;';
  46.             print ' } '."\n";
  47.             print '</script>'."\n";;
  48.             print "\n";
  49.             $loginOnClick ' return securePassword(); ';
  50.         }
  51.         echo '<center>'."\n";
  52.  
  53.         $status '';
  54.         if (!empty($caller->status&& $caller->status == AUTH_EXPIRED{
  55.             $status '<i>Your session has expired. Please login again!</i>'."\n";
  56.         else if (!empty($caller->status&& $caller->status == AUTH_IDLED{
  57.             $status '<i>You have been idle for too long. Please login again!</i>'."\n";
  58.         else if (!empty ($caller->status&& $caller->status == AUTH_WRONG_LOGIN{
  59.             $status '<i>Wrong login data!</i>'."\n";
  60.         else if (!empty ($caller->status&& $caller->status == AUTH_SECURITY_BREACH{
  61.             $status '<i>Security problem detected. </i>'."\n";
  62.         }
  63.         #PEAR::raiseError('You are using the built-in login screen of PEAR::Auth.<br />See the <a href="http://pear.php.net/manual/">manual</a> for details on how to create your own login function.', null);
  64.  
  65.         echo '<form method="post" action="'.$caller->server['PHP_SELF'].'" onSubmit="'.$loginOnClick.'">'."\n";
  66.         echo '<table border="0" cellpadding="2" cellspacing="0" summary="login form">'."\n";
  67.         echo '<tr>'."\n";
  68.         echo '    <td colspan="2" bgcolor="#eeeeee"><b>Login </b>'.$status.'</td>'."\n";
  69.         echo '</tr>'."\n";
  70.         echo '<tr>'."\n";
  71.         echo '    <td>Username:</td>'."\n";
  72.         echo '    <td><input type="text" id="'.$caller->getPostUsernameField().'" name="'.$caller->getPostUsernameField().'" value="' $username '" /></td>'."\n";
  73.         echo '</tr>'."\n";
  74.         echo '<tr>'."\n";
  75.         echo '    <td>Password:</td>'."\n";
  76.         echo '    <td><input type="password" id="'.$caller->getPostPasswordField().'" name="'.$caller->getPostPasswordField().'" /></td>'."\n";
  77.         echo '</tr>'."\n";
  78.         echo '<tr>'."\n";
  79.         
  80.         //onClick=" '.$loginOnClick.' "
  81.         echo '    <td colspan="2" bgcolor="#eeeeee"><input value="Login" id="doLogin" name="doLogin" type="submit" /></td>'."\n";
  82.         echo '</tr>'."\n";
  83.         echo '</table>'."\n";
  84.         // Might be a good idea to make the variable name variable 
  85.         echo '<input type="hidden" id="authsecret" name="authsecret" value="">';
  86.         echo '</form>'."\n";
  87.         echo '</center>'."\n\n";
  88.     }
  89.     
  90. }
  91.  
  92. ?>

Documentation generated on Mon, 11 Mar 2019 13:52:32 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.