<style>
    .message.error {
        background: #fe0000 none repeat scroll 0 0;
        color: #ffffff;
        line-height: 28px;
        font-size:15px;
        text-align:center;
        margin-bottom: 25px !important;
    }

    .message.success {
        background: #337ab7 none repeat scroll 0 0;
        color: #ffffff;
        font-size:15px;
        line-height: 28px;
        text-align:center;
        margin-bottom: 25px !important;
    }

    .ka-login-body .alert-danger{display: none !important;}

    .error {
        color: #ff0000;
    }

</style>

<?php
if (!empty($setting['logo_path'])) {
    $logo_path = $setting['logo_path'];
} else {
    $logo_path = 'images/logo/favicon.ico';
}



//$logo_path = 'images/logo/secure_portal.svg';
?>
<div class="container-fluid ka-login-body">
    <div style="font-size:35px; color:#fff; padding-bottom:15px; text-align:center; margin-top:50px;"><strong>
            <?php
            $header = 'London School of Learning Hub';

            if ((APP_SERVER_HOST_URL == CLIENT_PORTAL_DOMAIN) || (strpos(CLIENT_PORTAL_DOMAIN, $_SERVER['REDIRECT_REDIRECT_SSL_TLS_SNI']) !== false)) {
                $header = CLIENT_PORTAL_DEFAULT_HEADER;
            }
            echo $header;
            ?>

        </strong></div>

    <div class="ka-login">

        <div style="max-width:250px; margin:0 auto 0 auto; text-align: center">
            <!-- <img src="img/logo.png"  alt="" class="img-responsive ka-logo center-block"/> -->
            <?php if ((APP_SERVER_HOST_URL == CLIENT_PORTAL_DOMAIN) || (strpos(CLIENT_PORTAL_DOMAIN, $_SERVER['REDIRECT_REDIRECT_SSL_TLS_SNI']) !== false)) { ?>
                <img alt="Login Logo" src="<?php echo $this->Url->build(CLIENT_PORTAL_LOGO); ?>" style="max-width: 120px;">

            <?php } else {
                ?>
                <img alt="Login Logo" src="<?php echo $this->Url->build('/' . $logo_path); ?>" style="max-width: 220px;">

            <?php }
            ?>
        </div>
        <p>&nbsp;</p>
        <div class="">

            <?php
            echo $this->Form->create(null,['id'=>'login-form']);
            ?>
            <?= $this->Flash->render() ?>

            <div class="form-group">
                <label for="email">Email:</label>
                <!-- <input type="email" class="form-control" id="email" placeholder="Enter email" name="email"> -->
                <?php echo $this->Form->input('email', array('required' => 'required', 'class' => 'form-control FormControl1', 'id' => 'inputfeedback1', 'placeholder' => __('Email'), 'label' => false)); ?>
                <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
                <?php
                if (array_key_exists('username', $errors)) {
                    echo '<p class="unsuccess">';
                    if (array_key_exists('_empty', $errors['username'])) {
                        echo $errors['username']['_empty'];
                    }
                    echo '</p>';
                }
                ?>
            </div>
            <div class="form-group">
                <label for="pwd">Password:</label>
                <!-- <input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pwd"> -->
                <?php echo $this->Form->input('password', array('type' => 'password', 'required' => 'required', 'label' => false, 'class' => 'form-control FormControl1', 'id' => 'inputfeedback2', 'placeholder' => __('Password'))); ?>
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                <?php
                if (array_key_exists('password', $errors)) {
                    echo '<p class="unsuccess">';
                    if (array_key_exists('_empty', $errors['password'])) {
                        echo $errors['password']['_empty'];
                    }
                    echo '</p>';
                }
                ?>
            </div>
            <button type="submit" class="btn memberaccessButton">Submit</button>

            <?php echo $this->Form->end(); ?>

            <p>&nbsp;</p>

            <p>
                <!-- <a href="#">Forgot Password?</a> -->
                <a href="<?php echo $this->Url->build('/forgot_password'); ?>"><?php echo __('Forgot password?'); ?></a>
            </p>
        </div>
    </div>
    <div class="login-copyright"> <strong style="text-align:center">
            <?= $this->element('footer') ?>

    </div>

    <?php if($_SESSION['is_expired']){
        unset($_SESSION['is_expired']); ?>
        <script src="<?php echo $this->request->webroot;?>js/sweetalert2/sweetalert2.min.js"></script>
        <script>

            Swal.fire({
                title: 'Account has expired',
                text: 'Your 30 days has expired, you are now ready to upgrade to the full version. Would you like to upgrade now ?',
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes',
                cancelButtonText:'No'
            }).then(function (result) {
                if(result.value){
                    // window.location.href = 'https://www.clickletters.com/level-2';
                }
            })

        </script>
    <?php } ?>


    <script src="<?php echo $this->request->webroot;?>js/jsvalidate/jquery.validate.min.js"></script>
    <script type="text/javascript">

        $('#login-form').validate({
            rules:{
                'email':'required',
                'password':'required'

            },
            messages: {

                'password':{
                    required: "Please enter password"
                },
                'email':{
                    required: "Please enter email",
                }

            },
            highlight: function(element) {
                $(element).parent().addClass("has-error");
            },
            submitHandler: function(form) {
                form.submit();
            }
        });
    </script>