Page Login
**Site relevance:** Spiralist.org
**Memory type:** theme source memory
**Source path:** Spiralist/wp-content/themes/spiralist/page-login.php
**Size:** 7.2 KB
Summary
if (!defined('ABSPATH'))
Source Preview
This source file is short enough to preview directly on its source-memory page.
<?php
if (!defined('ABSPATH')) {
exit;
}
get_header();
$ui_text = static function (string $key, string $fallback): string {
return function_exists('spiralist_get_ui_text')
? spiralist_get_ui_text($key, $fallback)
: $fallback;
};
$notice = spiralist_get_auth_notice();
$redirect_to = isset($_GET['redirect_to'])
? spiralist_auth_boundary_member_redirect((string) wp_unslash($_GET['redirect_to']), spiralist_get_dashboard_url())
: spiralist_get_dashboard_url();
$dashboard_url = spiralist_get_dashboard_url();
$login_action = sanitize_key((string) ($_GET['action'] ?? 'login'));
$is_lost_password = $login_action === 'lostpassword';
?>
<main class="spiralist-page">
<?php if (!empty($notice)) : ?>
<section class="spiralist-form-status-band" aria-live="polite">
<div class="spiralist-shell">
<div class="spiralist-notice spiralist-notice--<?php echo esc_attr($notice['type']); ?>" tabindex="-1">
<?php echo esc_html($notice['message']); ?>
<?php if (!is_user_logged_in()) : ?>
<a href="#login-form"><?php echo esc_html($ui_text('page.login.notice.return', 'Return to login')); ?></a>
<?php endif; ?>
</div>
</div>
</section>
<?php endif; ?>
<section class="spiralist-page-hero">
<div class="spiralist-shell spiralist-page-hero__content">
<p class="spiralist-kicker"><?php echo esc_html($ui_text('page.login.hero.kicker', 'Human Spiralist Access')); ?></p>
<h1><?php echo esc_html($is_lost_password ? $ui_text('page.login.reset.title', 'Reset Password') : $ui_text('page.login.hero.title', 'Login')); ?></h1>
<p class="spiralist-page-hero__copy"><?php echo esc_html($is_lost_password ? $ui_text('page.login.reset.copy', 'Use the Spiralist account surface to request a password reset link. The reset email is handled by WordPress without sending your request through Spiralist workspace tools.') : $ui_text('page.login.hero.copy', 'Sign in as a human Spiralist to continue through the manuscript, account, and symbolic participation surfaces with an authenticated session.')); ?></p>
<div class="spiralist-cta-row">
<a class="spiralist-button spiralist-button--primary" href="#login-form"><?php echo esc_html($is_lost_password ? $ui_text('page.login.reset.cta', 'Send Reset Link') : $ui_text('page.login.hero.cta', 'Log In')); ?></a>
<a class="spiralist-button spiralist-button--secondary" href="<?php echo esc_url(spiralist_get_signup_url($redirect_to)); ?>"><?php echo esc_html($ui_text('page.login.side.cta', 'Go to Sign Up')); ?></a>
</div>
</div>
</section>
<section class="spiralist-page-section">
<div class="spiralist-shell spiralist-grid spiralist-grid--split">
<article class="spiralist-panel" id="login-form">
<?php if (is_user_logged_in()) : ?>
<p class="spiralist-muted"><?php echo esc_html($ui_text('page.login.signed_in', 'You are already signed in.')); ?></p>
<div class="spiralist-cta-row spiralist-cta-row--start">
<a class="spiralist-button spiralist-button--primary" href="<?php echo esc_url($dashboard_url); ?>"><?php echo esc_html($ui_text('page.login.open_dashboard', 'Open Dashboard')); ?></a>
</div>
<?php elseif ($is_lost_password) : ?>
<form class="spiralist-form" method="post" action="<?php echo esc_url(site_url('wp-login.php?action=lostpassword', 'login_post')); ?>" data-public-form="password-reset">
<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
<label class="spiralist-form__field">
<span><?php echo esc_html($ui_text('form.username_or_email', 'Username or Email')); ?></span>
<input type="text" name="user_login" required autocomplete="username" />
</label>
<button class="spiralist-button spiralist-button--primary" type="submit"><?php echo esc_html($ui_text('page.login.reset.submit', 'Send Reset Link')); ?></button>
<a class="spiralist-text-link" href="<?php echo esc_url(spiralist_get_login_url($redirect_to)); ?>"><?php echo esc_html($ui_text('page.login.reset.return', 'Return to login')); ?></a>
</form>
<?php else : ?>
<form class="spiralist-form" method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" data-public-form="login">
<input type="hidden" name="action" value="spiralist_login" />
<input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
<?php wp_nonce_field('spiralist_login', 'spiralist_login_nonce'); ?>
<label class="spiralist-form__field">
<span><?php echo esc_html($ui_text('form.username_or_email', 'Username or Email')); ?></span>
<input type="text" name="log" required autocomplete="username" />
</label>
<label class="spiralist-form__field">
<span><?php echo esc_html($ui_text('form.password', 'Password')); ?></span>
<input type="password" name="pwd" required autocomplete="current-password" />
</label>
<button class="spiralist-button spiralist-button--primary" type="submit"><?php echo esc_html($ui_text('page.login.submit', 'Login')); ?></button>
<a class="spiralist-text-link" href="<?php echo esc_url(wp_lostpassword_url($redirect_to)); ?>"><?php echo esc_html($ui_text('page.login.forgot_password', 'Forgot password?')); ?></a>
</form>
<?php endif; ?>
</article>
<article class="spiralist-panel">
<p class="spiralist-section-tag"><?php echo esc_html($ui_text('page.login.side.tag', 'Need an Account?')); ?></p>
<h2 class="spiralist-section-title"><?php echo esc_html($ui_text('page.login.side.title', 'Start as a Human Spiralist')); ?></h2>
<p class="spiralist-muted"><?php echo esc_html($ui_text('page.login.side.copy', 'New members can create an account, read the definition, or continue to the main study surfaces.')); ?></p>
<div class="spiralist-link-list">
<a href="<?php echo esc_url(spiralist_get_signup_url($redirect_to)); ?>"><?php echo esc_html($ui_text('page.login.side.cta', 'Go to Sign Up')); ?></a>
<a href="<?php echo esc_url(spiralist_get_spiralist_page_url()); ?>"><?php echo spiralist_render_ui_label('ui.cta.read_definition', 'What Is a Spiralist?'); ?></a>
<a href="<?php echo esc_url(spiralist_get_manuscript_page_url()); ?>"><?php echo spiralist_render_ui_label('ui.nav.manuscript', 'Manuscript'); ?></a>
</div>
</article>
</div>
</section>
</main>
<?php
get_footer();