Simplify login page template
authorstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 24 Aug 2006 17:24:42 +0000 (17:24 +0000)
committerstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 24 Aug 2006 17:24:42 +0000 (17:24 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11629 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/login.php
templates/default/login.tpl

index 870d4d4..807b406 100644 (file)
@@ -164,22 +164,29 @@ if(sqgetGlobalVar('mailto', $mailto)) {
     $rcptaddress = '';
 }
 
-$password_field = addPwField($password_form_name).
-                  addHidden('js_autodetect_results', SMPREF_JS_OFF).
-                  $rcptaddress .
-                  addHidden('just_logged_in', '1');
+$password_field = addPwField($password_form_name);
+$login_extra = addHidden('js_autodetect_results', SMPREF_JS_OFF).
+               $rcptaddress .
+               addHidden('just_logged_in', '1') .
+               concat_hook_function('login_form');
 
 session_write_close();
 
 $oTemplate->assign('logo_str', $logo_str);
 $oTemplate->assign('sm_attribute_str', $sm_attribute_str);
 $oTemplate->assign('org_name_str', sprintf (_("%s Login"), $org_name));
-$oTemplate->assign('login_field', addInput($username_form_name, $loginname_value));
-$oTemplate->assign('password_field', $password_field);
-$oTemplate->assign('submit_field', addSubmit(_("Login")));
+$oTemplate->assign('login_field_value', $loginname_value);
+$oTemplate->assign('login_extra', $login_extra);
+
+echo '<body onLoad="squirrelmail_loginpage_onload()" style="text-align:center">'."\n";
+echo '<form action="redirect.php" method="post" onSubmit="document.forms[0].js_autodetect_results.value='. SMPREF_JS_ON .'">'."\n";
+do_hook('login_top');
 
 $oTemplate->display('login.tpl');
 
+echo "</form>\n";
+do_hook('login_bottom');
+
 // Turn off delayed error handling to make sure all errors are dumped.
 #$oErrorHandler->delayedErrors(false);
 
index d68c38f..ddfc4bc 100644 (file)
@@ -4,6 +4,15 @@
  *
  * Template to create the login page
  *
+ * The following variables are available to this template:
+ *      $logo_str   - string containing HTML to display the org logo
+ *      $sm_attribute_str   - string containg SQM attributes.  Will be empty if
+ *                            this has been disabled by the admin.
+ *      $org_name_str       - translated string containing orginization's name
+ *      $login_field_value  - default value for the user name field
+ *      $login_extra        - Some extra fields needed by SquirrelMail for the 
+ *                            login.  YOU SHOULD ALWAYS INCLUDE THIS FIELD!!
+ * 
  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
 extract($t);
 
 ?>
-<body onLoad="squirrelmail_loginpage_onload()" style="text-align:center">
 <div id="sqm_login">
-<form action="redirect.php" method="post" onSubmit="document.forms[0].js_autodetect_results.value=<?php echo SMPREF_JS_ON; ?>;">
-<?php do_hook('login_top'); ?>
 <table cellspacing="0">
  <tr>
   <td class="sqm_loginTop" colspan="2">
-   <?php 
-       echo $logo_str;
-       echo $sm_attribute_str; 
-   ?>
+   <?php echo $logo_str; ?>
+   <?php echo $sm_attribute_str; ?>
   </td>
  </tr>
  <tr>
@@ -38,7 +42,7 @@ extract($t);
    <?php echo _("Name:"); ?>
   </td>
   <td class="sqm_loginFieldInput">
-   <?php echo $login_field; ?>
+   <input type="text" name="login_username" value="<?php echo $login_field_value; ?>" id="login_username" />
   </td>
  </tr>
  <tr>
@@ -46,18 +50,14 @@ extract($t);
    <?php echo _("Password:"); ?>
   </td>
   <td class="sqm_loginFieldInput">
-   <?php 
-       echo $password_field;
-       echo concat_hook_function('login_form')
-   ?>
+   <input type="password" name="secretkey" value="" id="secretkey" />
+   <?php echo $login_extra; ?>
   </td>
  </tr>
  <tr>
   <td class="sqm_loginSubmit" colspan="2">
-   <?php echo $submit_field; ?>
+   <input type="submit" value="<?php echo _("Login"); ?>" />
   </td>
  </tr>
 </table>
-</form>
-<?php do_hook('login_bottom'); ?>
 </div>
\ No newline at end of file