wip-feat: user, login/logout, authentication/authorization
This commit is contained in:
52
templates/user/login.html.twig
Normal file
52
templates/user/login.html.twig
Normal file
@@ -0,0 +1,52 @@
|
||||
{% extends 'bare.html.twig' %}
|
||||
|
||||
{% block title %}Log in — Torsearch{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="flex flex-col bg-orange-500 p-4 rounded-lg gap-2 min-w-96">
|
||||
<h2 class="text-xl text-gray-50">Login</h2>
|
||||
<form method="post" class="flex flex-col gap-2">
|
||||
{% if error %}
|
||||
<div class="bg-red-400 border-red-600 rounded p-2 text-red-600">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ path('app_logout') }}">Logout</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<label for="username" class="mb-2 flex flex-col text-gray-950">
|
||||
Email
|
||||
<input type="email"
|
||||
value="{{ last_username }}"
|
||||
name="_username"
|
||||
id="username"
|
||||
class="bg-gray-50 text-gray-950 p-1 rounded-md"
|
||||
autocomplete="email"
|
||||
required autofocus>
|
||||
</label>
|
||||
|
||||
<label for="password" class="mb-2 flex flex-col text-gray-950">
|
||||
Password
|
||||
<input type="password"
|
||||
name="_password"
|
||||
id="password"
|
||||
class="bg-gray-50 text-gray-950 p-1 rounded-md"
|
||||
autocomplete="current-password"
|
||||
required>
|
||||
</label>
|
||||
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" data-controller="csrf-protection">
|
||||
|
||||
<div class="mb-2">
|
||||
<input type="checkbox" name="_remember_me" id="_remember_me">
|
||||
<label for="_remember_me">Remember me</label>
|
||||
</div>
|
||||
|
||||
|
||||
<button class="bg-green-600 px-1.5 py-1 rounded-md text-gray-50" type="submit">
|
||||
Sign in
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
43
templates/user/register.html.twig
Normal file
43
templates/user/register.html.twig
Normal file
@@ -0,0 +1,43 @@
|
||||
{% extends 'bare.html.twig' %}
|
||||
|
||||
{% block title %}Register{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="flex flex-col bg-orange-500 p-4 rounded-lg gap-2 min-w-96">
|
||||
<h2 class="text-xl text-gray-50">Register</h2>
|
||||
|
||||
{{ form_errors(registrationForm) }}
|
||||
|
||||
{{ form_start(registrationForm) }}
|
||||
|
||||
<label for="name" class="flex flex-col mb-2">
|
||||
{{ field_label(registrationForm.name) }}
|
||||
<input type="text"
|
||||
name="{{ field_name(registrationForm.name) }}"
|
||||
id="{{ field_name(registrationForm.name) }}"
|
||||
value="{{ field_value(registrationForm.name) }}"
|
||||
class="bg-gray-50 text-gray-950 p-1 rounded-md" />
|
||||
</label>
|
||||
|
||||
<label for="email" class="flex flex-col mb-2">
|
||||
{{ field_label(registrationForm.email) }}
|
||||
<input type="email"
|
||||
name="{{ field_name(registrationForm.email) }}"
|
||||
id="{{ field_name(registrationForm.email) }}"
|
||||
value="{{ field_value(registrationForm.email) }}"
|
||||
class="bg-gray-50 text-gray-950 p-1 rounded-md" />
|
||||
</label>
|
||||
|
||||
<label for="password" class="flex flex-col mb-2">
|
||||
{{ field_label(registrationForm.plainPassword) }}
|
||||
<input type="password"
|
||||
name="{{ field_name(registrationForm.plainPassword) }}"
|
||||
id="{{ field_name(registrationForm.plainPassword) }}"
|
||||
value="{{ field_value(registrationForm.plainPassword) }}"
|
||||
class="bg-gray-50 text-gray-950 p-1 rounded-md" />
|
||||
</label>
|
||||
|
||||
<button type="submit" class="bg-green-600 px-1.5 py-1 rounded-md text-gray-50">Register</button>
|
||||
{{ form_end(registrationForm) }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user