<section id="page-title">

    <div class="container clearfix">
    
        <?php
        if(!defined('OSTCLIENTINC')) die('Access Denied');

        $email=Format::input($_POST['luser']?:$_GET['e']);
        $passwd=Format::input($_POST['lpasswd']?:$_GET['t']);


        $content = Page::lookupByType('banner-client');

        if ($content) {
            list($title, $body) = $ost->replaceTemplateVariables(
                array($content->getName(), $content->getBody()));
        } else {
            
            $title = __('Sign In');
        }

        ?>   

        <h4 class="nobottommargin"><?php echo Format::display($title); ?></h4>
            <ol class="breadcrumb">
                <li><a href="<?php echo ROOT_PATH; ?>index.php">Home &nbsp;&nbsp;</a></li>
                <li>/</li>
                <li class="active"><a href="<?php echo ROOT_PATH; ?>login.php">&nbsp;&nbsp; Login</a></li>
            </ol>
        

    </div>

</section>

<section id="content">

    <div class="content-wrap">

        <div class="container clearfix">

                
                <?php
                    if(!defined('OSTCLIENTINC')) die('Access Denied');

                    $email=Format::input($_POST['luser']?:$_GET['e']);
                    $passwd=Format::input($_POST['lpasswd']?:$_GET['t']);

                    $content = Page::lookupByType('banner-client');

                    if ($content) {
                        list($title, $body) = $ost->replaceTemplateVariables(
                            array($content->getName(), $content->getBody()));
                    } else {
                            
                        $title = __('Sign In');
                    }
                ?>


            <div class="col_one_third nobottommargin">
                        
                <div class="well well-lg nobottommargin">

                    <h3>Login to your Account</h3>

                        <form action="login.php" method="post" id="clientLogin nobottommargin" style="margin-bottom: 0px !important; ">
                                <?php csrf_token(); ?>

                            <strong><?php echo Format::htmlchars($errors['login']); ?></strong>

                                <div class="col_full">
                                    <input class="form-control" id="login-form-username" placeholder="<?php echo __('eMail or Username'); ?>" type="text" name="luser" size="30" value="<?php echo $email; ?>">
                                </div>

                                <div class="col_full">
                                    <input class="form-control" id="login-form-password" placeholder="<?php echo __('Password'); ?>" type="password" name="lpasswd" size="30" value="<?php echo $passwd; ?>">
                                </div>

                                <div class="col_full nobottommargin">
                                    <input class="button button-3d button-green nomargin" type="submit" value="<?php echo __('Sign In'); ?>">
                                        <?php if ($suggest_pwreset) { ?>
                                        <a href="pwreset.php" class="fright"><?php echo __('Forgot My Password'); ?></a>                                                
                                        <?php } ?>
                                </div>
                            </form>        
                        </div>            
                    </div>

                    <div class="col_two_third col_last nobottommargin">

                        <h3>Don't have an Account? Register Now.</h3>
                            <?php

                            $ext_bks = array();
                            foreach (UserAuthenticationBackend::allRegistered() as $bk)
                                if ($bk instanceof ExternalAuthentication)
                                    $ext_bks[] = $bk;

                            if (count($ext_bks)) {
                                foreach ($ext_bks as $bk) { ?>
                            <div class="external-auth"><?php $bk->renderExternalLink(); ?></div><?php
                                }
                            }


                            if ($cfg && $cfg->isClientRegistrationEnabled()) {
                                if (count($ext_bks)) echo '<hr style="width:70%"/>'; ?>
                                <h3 style="margin-bottom: 45px">
                                <a href="account.php?do=create"><?php echo __('Create an Account'); ?></a>
                                </h3>
                            <?php } ?>
                      
                    </div>
                    <br>
                    <p>
                        <?php
                        if ($cfg->getClientRegistrationMode() != 'disabled'
                        || !$cfg->isClientLoginRequired()) {
                         echo sprintf(__('If this is your first time contacting us or you\'ve lost the ticket number, please %s open a new ticket %s'),
                          '<a href="open.php">', '</a>');
                        } ?>
                    </p>
                </div>
            </div>
        </div>        
    </div>    
</section>