<?php
/*
 * Client Portal
 * User profile
 */

header("Content-Security-Policy: default-src 'self'");

require_once 'includes/inc_all.php';

?>

    <h2>Profile</h2>

    <p>Name: <?= stripslashes(escapeHtml($session_contact_name)) ?></p>
    <p>Email: <?= $session_contact_email ?></p>
    <p>PIN: <?= $session_contact_pin ?></p>
    <p>Client: <?= $session_client_name ?></p>
    <br>
    <p>Client Primary Contact: <?php if ($session_contact_primary == 1) {echo "Yes"; } else {echo "No";} ?></p>
    <p>Client Technical Contact: <?php if ($session_contact_is_technical_contact) {echo "Yes"; } else {echo "No";} ?></p>
    <p>Client Billing Contact: <?php if ($session_contact_is_billing_contact == $session_contact_id) {echo "Yes"; } else {echo "No";} ?></p>
    <br>
    <p>Login via: <?= $_SESSION['login_method'] ?> </p>
    <p>User ID: <?= $_SESSION['user_id'] ?> </p>


    <!--  // Show option to change password if auth provider is local -->
<?php if ($_SESSION['login_method'] == 'local'): ?>
    <hr>
    <div class="col-md-6">
        <h4>Password</h4>
        <form action="post.php" method="post" autocomplete="off">
            <input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
            <div class="mb-3">
                <label>New Password</label>
                <div class="input-group">
                        <span class="input-group-text"><i class="fa fa-fw fa-lock"></i></span>
                    <input type="password" class="form-control" minlength="8" required data-toggle="password" name="new_password" placeholder="Leave blank for no change" autocomplete="new-password">
                </div>
            </div>
            <button type="submit" name="edit_profile" class="btn btn-primary text-bold mt-3"><i class="fas fa-check me-2"></i>Save password</button>
        </form>
    </div>
<?php endif ?>

<?php
require_once 'includes/footer.php';
