Compare commits

...

4 commits

Author SHA1 Message Date
Jannis Portmann
445d097683 Improve layout 2023-04-16 19:25:34 +02:00
Jannis Portmann
8e40e81c19 Remove templates 2023-04-16 19:19:23 +02:00
Jannis Portmann
849744e337 Password reset option 2023-04-16 19:19:05 +02:00
Jannis Portmann
22d7fb2718 Add user menu 2023-04-16 14:27:38 +02:00
11 changed files with 66 additions and 61 deletions

View file

@ -100,12 +100,24 @@
<hr class="d-lg-none">
<div class="d-flex flex-row">
{% if request.user.is_authenticated %}
<li class="nav-item me-2 md-me-0">
<a href="{% url 'user_profile' %}">
<div class="nav-link mr-auto">
<i class="me-1 fa-solid fa-user"></i>{{ request.user.username }}
</div>
</a>
<li class="nav-item dropdown me-2">
<a class="nav-link dropdown-toggle"
href="#"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false"><i class="me-1 fa-solid fa-user"></i>{{ request.user.username }}</a>
<ul class="dropdown-menu">
<li class="dropdown-item me-2 md-me-0">
<a href="{% url 'user_profile' %}">
<div class="nav-link mr-auto">
<i class="me-1 fa-solid fa-user"></i> Account
</div>
</a>
</li>
<li class="dropdown-item">
<a class="nav-link" href="{% url 'wishlist' user.id %}"><i class="fa-solid fa-star"></i><span class="ms-2">Wishlist</span></a>
</li>
</ul>
</li>
{% endif %}
<li class="nav-item">

View file

@ -0,0 +1,5 @@
{% extends 'base.html' %}
{% block content %}
<h1>Reset password</h1>
<p>New password was set successfully. Please login again.</p>
{% endblock %}

View file

@ -0,0 +1,11 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<h1>Reset password</h1>
<p>Choose a new password.</p>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Submit" class="btn btn-pfl"/>
</form>
{% endblock %}

View file

@ -0,0 +1,11 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<h1>Reset password</h1>
<p>Enter the email of your account, you'll then recieve a reset link.</p>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Submit" class="btn btn-pfl"/>
</form>
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends 'base.html' %}
{% block content %}
<h1>Reset password</h1>
<p>
We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.
</p>
<p>
If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder.
</p>
{% endblock %}

View file

@ -1,11 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Password Reset Email Sent{% endblock %}
{% block content %}
<p>
An email has been sent that contains a link that you can click to reset your password.
This link will expire in {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}.
</p>
<p>If you don't receive an email please check your spam folder or <a href="{{ path('app_forgot_password_request') }}">try again</a>.</p>
{% endblock %}

View file

@ -1,9 +0,0 @@
<h1>Hi!</h1>
<p>To reset your password, please visit the following link</p>
<a href="{{ url('app_reset_password', {token: resetToken.token}) }}">{{ url('app_reset_password', {token: resetToken.token}) }}</a>
<p>This link will expire in {{ resetToken.expirationMessageKey|trans(resetToken.expirationMessageData, 'ResetPasswordBundle') }}.</p>
<p>Cheers!</p>

View file

@ -1,22 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Reset your password{% endblock %}
{% block content %}
{% for flashError in app.flashes('reset_password_error') %}
<div class="alert alert-danger" role="alert">{{ flashError }}</div>
{% endfor %}
<h1>Reset your password</h1>
{{ form_start(requestForm) }}
{{ form_row(requestForm.email) }}
<div class="mb-3">
<small>
Enter your email address and we we will send you a
link to reset your password.
</small>
</div>
<button class="btn btn-pfl">Send password reset email</button>
{{ form_end(requestForm) }}
{% endblock %}

View file

@ -1,11 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Reset your password{% endblock %}
{% block content %}
<h1>Reset your password</h1>
{{ form_start(resetForm) }}
{{form_widget(resetForm)}}
{{ form_end(resetForm) }}
{% endblock %}

View file

@ -4,14 +4,15 @@
<h1 class="mb-4">
User details <span class="badge bg-secondary">{{ user.username }}</span>
</h1>
<div class="alert alert-warning">Some functions do not work yet!</div>
<div class="mb-5">
<h2>Settings</h2>
<button type="button" class="btn btn-pfl">Change Password</button>
<a class="btn btn-pfl" href="{% url 'password_reset' %}">Change Password</a>
</div>
<div class="mb-3">
<h2>Delete Account</h2>
<button class="btn btn-danger">
<i class="me-1 fa-regular fa-triangle-exclamation"></i>Delete Account
<i class="me-1 fa-solid fa-triangle-exclamation"></i>Delete Account
</button>
</div>
{% endblock %}

View file

@ -19,6 +19,14 @@ urlpatterns = [
path('accounts/login/', auth_views.LoginView.as_view(template_name='registration/login.html')),
path('accounts/profile/', auth_views.LoginView.as_view(template_name='user/detail.html'), name='user_profile'),
path('accounts/register/', views.register_user, name='register_user'),
path('accounts/password_reset/', auth_views.PasswordResetView.as_view(template_name='registration/verify_email.html',
extra_context={'form_helper': settings.CRISPY_TEMPLATE_PACK}), name='password_reset'),
path('accounts/password_reset/done/',
auth_views.PasswordResetDoneView.as_view(template_name='registration/verify_email_done.html')),
path('accounts/reset/<uidb64>/<token>/',
auth_views.PasswordResetConfirmView.as_view(template_name='registration/password_reset_confirm.html', extra_context={'form_helper': settings.CRISPY_TEMPLATE_PACK})),
path('accounts/reset/<uidb64>/<token>/',
auth_views.PasswordResetCompleteView.as_view(template_name='registration/password_reset_complete.html')),
path('accounts/', include('django.contrib.auth.urls')),
path("faq/", TemplateView.as_view(template_name='app/faq.html'), name="faq"),
path("imprint/", TemplateView.as_view(template_name='app/imprint.html'), name="imprint"),