Files
wc-bootstrap/templates/global/form-login.html.twig

90 lines
3.2 KiB
Twig
Raw Normal View History

{#
# Global Login Form (Bootstrap 5 Override)
#
# Inline login form used on checkout and other pages (not the My Account login).
# Can be initially hidden and toggled via a link.
#
# Expected context (from WooCommerce wc_get_template('global/form-login.php')):
# hidden - Whether form is initially hidden (boolean)
# message - Optional message to display above the form
# redirect - URL to redirect after login
#
# WooCommerce PHP equivalent: global/form-login.php
#
# @package WcBootstrap
# @since 0.1.0
#}
{% if not is_user_logged_in() %}
<form class="woocommerce-form woocommerce-form-login login{% if hidden %} d-none{% endif %}" method="post">
{{ do_action('woocommerce_login_form_start') }}
{% if message %}
<div class="mb-3">
{{ message|wpautop }}
</div>
{% endif %}
<div class="row g-3 mb-3">
<div class="col-sm-6">
<label for="username" class="form-label">
{{ __('Username or email') }}&nbsp;<span class="text-danger" aria-hidden="true">*</span>
<span class="visually-hidden">{{ __('Required') }}</span>
</label>
<input type="text"
class="form-control"
name="username"
id="username"
autocomplete="username"
required
aria-required="true" />
</div>
<div class="col-sm-6">
<label for="password" class="form-label">
{{ __('Password') }}&nbsp;<span class="text-danger" aria-hidden="true">*</span>
<span class="visually-hidden">{{ __('Required') }}</span>
</label>
<input type="password"
class="form-control"
name="password"
id="password"
autocomplete="current-password"
required
aria-required="true" />
</div>
</div>
{{ do_action('woocommerce_login_form') }}
<div class="d-flex align-items-center justify-content-between flex-wrap gap-2">
<div class="form-check">
<input class="form-check-input"
type="checkbox"
name="rememberme"
id="rememberme"
value="forever" />
<label class="form-check-label" for="rememberme">
{{ __('Remember me') }}
</label>
</div>
{{ wp_nonce_field('woocommerce-login', 'woocommerce-login-nonce') }}
<input type="hidden" name="redirect" value="{{ redirect|esc_url }}" />
<button type="submit"
class="btn btn-primary"
name="login"
value="{{ __('Login') }}">
{{ __('Login') }}
</button>
</div>
<p class="mt-3 mb-0">
<a href="{{ wp_lostpassword_url()|esc_url }}">{{ __('Lost your password?') }}</a>
</p>
{{ do_action('woocommerce_login_form_end') }}
</form>
{% endif %}