First Commit
This commit is contained in:
Executable
+131
@@ -0,0 +1,131 @@
|
||||
{% extends "layouts/base.twig" %}
|
||||
|
||||
{% block title %}{{ __('auth.register_title', {'platformName': platformName}) }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-5">
|
||||
<div class="card shadow-lg border-0 rounded-lg mt-5">
|
||||
<div class="card-header">
|
||||
<h3 class="text-center font-weight-light my-4">
|
||||
{{ __('auth.register_title', {'platformName': platformName}) }}
|
||||
</h3>
|
||||
</div>
|
||||
<div class="card-body p-4">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error == 'captcha' ? __('auth.invalid_captcha') : __('auth.registration_error') }}
|
||||
{{ error == 'rate' ? __('auth.too_many_attempts') : '' }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="POST" action="{{ url('register') }}">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="{{ __('auth.name_placeholder') }}" value="{{ old('name') }}" required>
|
||||
<label for="name">{{ __('auth.name') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input type="email" class="form-control" id="email" name="email" placeholder="{{ __('auth.email_placeholder') }}" value="{{ old('email') }}" required>
|
||||
<label for="email">{{ __('auth.email') }}</label>
|
||||
</div>
|
||||
|
||||
{% include 'components/password-field.twig' with {
|
||||
id: 'password',
|
||||
name: 'password',
|
||||
label: __('auth.password'),
|
||||
placeholder: __('auth.password_placeholder'),
|
||||
required: true
|
||||
} %}
|
||||
|
||||
{% include 'components/password-field.twig' with {
|
||||
id: 'password_confirmation',
|
||||
name: 'password_confirmation',
|
||||
label: __('auth.password_confirmation'),
|
||||
placeholder: __('auth.password_confirmation_placeholder'),
|
||||
required: true
|
||||
} %}
|
||||
|
||||
{% if require_captcha_register %}
|
||||
<div class="mb-3" x-data="{
|
||||
num1: 0,
|
||||
num2: 0,
|
||||
userAnswer: '',
|
||||
solved: false,
|
||||
generate() {
|
||||
this.num1 = Math.floor(Math.random() * 10) + 1;
|
||||
this.num2 = Math.floor(Math.random() * 10) + 1;
|
||||
this.userAnswer = '';
|
||||
this.solved = false;
|
||||
},
|
||||
check() {
|
||||
if (parseInt(this.userAnswer) === (this.num1 + this.num2)) {
|
||||
this.solved = true;
|
||||
} else {
|
||||
this.solved = false;
|
||||
}
|
||||
}
|
||||
}" x-init="generate()">
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold mb-2">{{ __('auth.security_check') }}</label>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
<div class="px-3 py-2 bg-white border rounded fw-bold fs-5 text-nowrap">
|
||||
<span x-text="num1"></span> + <span x-text="num2"></span> =
|
||||
</div>
|
||||
<input type="number" class="form-control" style="width: 80px;" x-model="userAnswer" @input="check()" placeholder="?">
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm ms-1" @click="generate()" title="{{ __('auth.captcha_reload') }}">
|
||||
<i class="bi bi-arrow-clockwise"></i> ↻
|
||||
</button>
|
||||
</div>
|
||||
<div class="mt-2" style="min-height: 24px;">
|
||||
<span x-show="solved" class="text-success fw-bold small">
|
||||
✓ {{ __('auth.captcha_solved') }}
|
||||
</span>
|
||||
<span x-show="!solved" class="text-muted small">
|
||||
{{ __('auth.captcha_instruction') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="captcha_valid" :value="solved ? '1' : ''">
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" id="terms" name="terms" required>
|
||||
<label class="form-check-label" for="terms">
|
||||
{{ __('auth.accept_terms') }}
|
||||
<a href="/user_terms.html" target="_blank">
|
||||
{{ __('auth.read_terms') }}
|
||||
</a>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="d-grid">
|
||||
<button class="btn btn-primary btn-lg" type="submit">
|
||||
{{ __('auth.register_button') }}
|
||||
</button>
|
||||
<a href="{{ url('login') }}" class="btn btn-link">
|
||||
{{ __('auth.back_to_login') }}
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script>
|
||||
// Auto-focus on name field
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const nameField = document.getElementById('name');
|
||||
if (nameField) {
|
||||
nameField.focus();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user