Add account settings page with YouTube connection management and user update functionality

This commit is contained in:
Edgar P. Burkhart 2025-06-15 11:19:12 +02:00
parent da1c750771
commit cd0ca2f5ea
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
7 changed files with 62 additions and 8 deletions

View file

@ -0,0 +1,37 @@
{% extends "base.html" %}
{% load form %}
{% block content %}
<h1>
<i class="ri-user-settings-fill"></i> Mon compte
</h1>
{% for error in form.non_field_errors %}<article class="message error">{{ error }}</article>{% endfor %}
<form method="post" {% if action %}action="{% url action %}"{% endif %}>
{% csrf_token %}
<fieldset>
{% if not user.youtubecredentials.credentials %}
<a href="{% url "youtube_login" %}" role="button"><i class="ri-youtube-fill"></i> Me connecter au compte Youtube</a>
{% else %}
<button type="submit"
formaction="{% url "youtube_logout" %}"
class="secondary">
<i class="ri-youtube-fill"></i> Déconnecter le compte Youtube <strong>{{ user.youtubecredentials.title }}</strong>
</button>
{% endif %}
</fieldset>
<fieldset>
{% for field in form %}
<label for="{{ field.id_for_label }}">
{{ field.label }}
{{ field }}
{% if field.errors %}
<small id="{{ field.errors.field_id }}_error" class="form-error">{{ field.errors|join:", " }}</small>
{% endif %}
</label>
{% endfor %}
<button type="submit">Mettre à jour mon compte</button>
</fieldset>
<fieldset>
<a href="{% url "password_change" %}" role="button" class="secondary">Changer mon mot de passe</a>
</fieldset>
</form>
{% endblock content %}

View file

@ -47,7 +47,9 @@
<nav>
<ul>
{% if user.is_authenticated %}
<li>{{ user.username }}</li>
<li>
<a href="{% url "account_settings" %}">{{ user.username }}</a>
</li>
<li>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}