<!DOCTYPE html>
<html lang="en">
<?php $this->load->view('auth/head'); ?>

<body>
<div class="login-wrapper">
    <!--[if lte IE 7]><script src="<?php echo get_scriptdir() ?>/ieupgrade/warning.js"></script><script>window.onload=function(){e("<?php echo get_scriptdir() ?>/ieupgrade/")}</script><![endif]-->
    <div id="login">
        <div class="login-box change-password">
            <h2 class="center">Set your new password</h2>
            <div id="login-form-container" class="margin-top">
                <p id="password-reset-completed" style="display: none" class="alert alert-info">Password successfully changed. Redirecting to the login page...</p>
                <div id="formInfoMessage"
                     class="margin-top"><?php if (isset($message) && $message != '') echo $message; ?></div>

                <div id="login-form-container" style="margin-top:40px">
                    <?= form_open(
                        'auth/reset-password/change?token=' . ($token ?? ''),
                        array('id' => 'change_password', 'class' => 'form-horizontal')
                    ); ?>

                    <input type="hidden" name="token" value="<?= htmlspecialchars($token ?? '') ?>">

                    <div class="control-group required">
                        <label class="control-label" for="new">New password</label>
                        <div class="controls">
                            <input id="new" type="password" required name="new" class="invalid"
                                   value="<?php echo set_value('new'); ?>">
                            <?php $this->load->view('common/show-password-btn.php'); ?>
                        </div>
                    </div>
                    <div class="control-group required">
                        <label class="control-label no-padding no-margin" for="new_confirm">Confirm new password</label>
                        <div class="controls">
                            <input id="new_confirm" type="password" required name="new_confirm"
                                   value="<?php echo set_value('new_confirm'); ?>">
                            <?php $this->load->view('common/show-password-btn.php'); ?>
                        </div>
                    </div>

                    <div class="control-group">
                        <div class="controls">
                            <button type="submit" id="save"
                                    class="btn btn-large btn-primary float-right margin-left-small">
                                Save
                            </button>
                            <a href="<?php echo site_url('/'); ?>"
                               class="btn btn-large btnCancel float-right" type="button">Cancel</a>
                        </div>
                    </div>

                    <?php echo form_close(); ?>
                </div>
                <div id="msg"></div>
            </div>
        </div>
    </div>
</div>
</div>
<script>
    // initialized variables used in changePassword.js script
    var minPasswordLength = <?= $minPasswordLength ?>;
    var passwordComplexity = <?= $passwordComplexity ?>;
</script>
<?php $this->carabiner->display('login'); ?>
<?php $this->carabiner->display('change_password'); ?>
</body>
</html>
