<?php

/**
 * @var Johncms\Users\User $confirm_user
 *
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => __('Email confirmation'),
        'page_title' => __('Email confirmation'),
    ]
) ?>

<?php if ($confirm_user === null): ?>
    <div class="alert alert-danger"><?= __('User is not found') ?></div>
<?php elseif ($confirm_user->email_confirmed): ?>
    <div class="alert alert-success"><?= __('Thanks! Your e-mail has been successfully confirmed.') ?></div>
    <?php if (! $user->isValid()): ?>
        <div class="mt-2">
            <a href="/login/" class="btn btn-primary"><?= d__('system', 'Log In') ?></a>
        </div>
    <?php endif; ?>
<?php elseif (! $confirm_user->email_confirmed): ?>
    <div class="alert alert-danger"><?= __('Error when confirming e-mail. Invalid confirmation code.') ?></div>
<?php endif; ?>
