Jun 26 - Implement registration function for user to register account
This commit is contained in:
@@ -93,6 +93,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Registration Settings -->
|
||||
<div class="card mt-4">
|
||||
<div class="card-header"><h2 class="card-title">👤 User Registration</h2></div>
|
||||
<form method="post" action="{{ url_for('admin_settings.save_registration') }}">
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Allow Self-Registration</label>
|
||||
<select class="form-control" name="registration_enabled">
|
||||
<option value="0" {{ 'selected' if registration.get('registration.enabled') != '1' }}>Disabled (default)</option>
|
||||
<option value="1" {{ 'selected' if registration.get('registration.enabled') == '1' }}>Enabled</option>
|
||||
</select>
|
||||
<small class="text-muted" style="display:block;margin-top:.35rem">
|
||||
When enabled, a "Create Account" link appears on the login page.
|
||||
New accounts are always created with the <strong>User</strong> role.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-primary" type="submit">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function testConnection(type) {
|
||||
var url = type === 'email' ? '/admin/settings/test-email' : '/admin/settings/test-groq';
|
||||
|
||||
@@ -37,6 +37,12 @@
|
||||
<p style="text-align:center;margin-top:1rem;font-size:.875rem">
|
||||
<a href="{{ url_for('auth.forgot_password') }}" style="color:var(--accent)">Forgot password?</a>
|
||||
</p>
|
||||
{% if reg_enabled %}
|
||||
<p style="text-align:center;margin-top:.5rem;font-size:.875rem">
|
||||
Don't have an account?
|
||||
<a href="{{ url_for('auth.register') }}" style="color:var(--accent)">Create one</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Create Account — Website Checker</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body class="login-wrap">
|
||||
<div class="login-box">
|
||||
|
||||
<div class="login-logo">
|
||||
<span class="brand-icon">🌐</span>
|
||||
<h1>Website Checker</h1>
|
||||
<p>Create Account</p>
|
||||
</div>
|
||||
|
||||
{% if errors %}
|
||||
{% for err in errors %}
|
||||
<div class="alert alert-danger mb-2">{{ err }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{{ url_for('auth.register') }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username"
|
||||
value="{{ username or '' }}"
|
||||
autocomplete="username" autofocus required minlength="3">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="full_name">Full Name <span class="text-muted" style="font-weight:400">(optional)</span></label>
|
||||
<input type="text" id="full_name" name="full_name"
|
||||
value="{{ full_name or '' }}"
|
||||
autocomplete="name">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="email">Email <span class="text-muted" style="font-weight:400">(optional)</span></label>
|
||||
<input type="email" id="email" name="email"
|
||||
value="{{ email or '' }}"
|
||||
autocomplete="email">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password"
|
||||
autocomplete="new-password" required minlength="8"
|
||||
placeholder="Minimum 8 characters">
|
||||
<div class="pw-strength-wrap">
|
||||
<div class="pw-strength-bar"><div class="pw-strength-fill" id="pw-fill"></div></div>
|
||||
<small class="pw-strength-label" id="pw-label"></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="confirm_password">Confirm Password</label>
|
||||
<input type="password" id="confirm_password" name="confirm_password"
|
||||
autocomplete="new-password" required placeholder="Repeat password">
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary w-full" type="submit">Create Account</button>
|
||||
</form>
|
||||
|
||||
<p style="text-align:center;margin-top:1rem;font-size:.875rem">
|
||||
Already have an account?
|
||||
<a href="{{ url_for('auth.login') }}" style="color:var(--accent)">Sign in</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<script src="{{ url_for('static', filename='js/pw-strength.js') }}"></script>
|
||||
<script>attachPasswordStrength('password', 'pw-fill', 'pw-label');</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user