User Tools

Site Tools


portals:login-page

Login.php

The following needs to be on top of the page (before the html tag). The first one is responsible for the hsmx functions, the second one will execute the login.

<?php
	require_once($_SERVER['DOCUMENT_ROOT']."/hsm/include/initialize.php");
	require($_SERVER['DOCUMENT_ROOT']."/hsm/login_execute.php");
?>

You can use a body tag like this one.

<body <?=($error!=""?'onload="document.loginForm.username.focus(); alert(\'' . $error . '\')"':'')?> <?=($error_guest!=""?'onload="document.guestloginForm.submit_in_house_guest.focus(); alert(\'' . $error_guest . '\')"':'')?>>

When there is an error (a field isn't filled in correct) then is this going to show a popup window using javascript with an error message.

You'll also need to add the following in the html body:

 if($mail_setting->enable_voucher==1)
 {
 ?>
    <form method="post" action="index.php<?=$sessionurl2?>" onSubmit="this.submitbutton.disabled=true;">
       <input type="hidden" name="login" value="true">                    
       <?php if($mail_setting->code_only==1) { ?>
          <b>Voucher code:</b>
          <input type="text" class="loginInput" name="username" value="<?=$username?>" onKeyUp="document.loginForm.password.value=document.loginForm.username.value">
          <input type="hidden" name="password">
       <?php } 
       else { ?>                    
          <label class="loginLabel">Username:</label></br>
          <input type="text" class="loginInput" name="username" value="<?=$user?>" placeholder="Username"></br>
          <label class="loginLabel">Password:</label></br>
          <input type="password" class="loginInput" name="password" placeholder="Password"></br>
       <?php
       }
       ?>                                                         <!-- to disable the button in portal preview mode -->
                    <input name="submitbutton" type="submit" class="btnSubmit"<?=(isset($_SESSION['PORTAL']['preview'])?"disabled":"")?> value="Login">
   </form>
   <?php
   }
   ?>

if($mail_setting→enable_voucher==1) is going to check that voucher login is enabled in the portal. if($mail_setting→code_only==1) will check the voucher code only setting (Layout → settings)

portals/login-page.txt · Last modified: 2015/03/19 15:08 by maarten