mirror of
https://github.com/MOIS3Y/logs-collector.git
synced 2025-09-13 13:13:01 +02:00
Add: account views, tests, override user model
This commit is contained in:
30
logs_collector/account/templates/account/base.html
Normal file
30
logs_collector/account/templates/account/base.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block account_head %}
|
||||
<title>{% block title %}{% endblock title %}</title>
|
||||
{% endblock account_head %}
|
||||
|
||||
{% block account_content %}
|
||||
<header class="sticky-top">
|
||||
<section>
|
||||
{% include 'includes/navigation.html' %}
|
||||
</section>
|
||||
</header>
|
||||
<main>
|
||||
<section>
|
||||
{% block main %}{% endblock main %}
|
||||
</section>
|
||||
</main>
|
||||
<footer class="footer mt-auto">
|
||||
<section>
|
||||
{% include 'includes/footer.html' %}
|
||||
</section>
|
||||
</footer>
|
||||
{% endblock account_content %}
|
||||
|
||||
{% block account_scripts %}
|
||||
<script src="{% static 'collector/js/jquery-3.7.0.min.js' %}"></script>
|
||||
{% block bs %}{% endblock bs %}
|
||||
{% block jquery %}{% endblock jquery %}
|
||||
{% endblock account_scripts %}
|
@@ -0,0 +1,39 @@
|
||||
<div class="container">
|
||||
<h5 class="card-title">Authentication</h5>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><i class="bi bi-person-circle"></i></span>
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
placeholder="{{ request.user.username }}"
|
||||
aria-label="Username"
|
||||
disabled
|
||||
readonly
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 mb-4">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><i class="bi bi-shield-lock"></i></span>
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
placeholder="●●●●●●●●"
|
||||
aria-label="Password"
|
||||
disabled
|
||||
readonly
|
||||
>
|
||||
<a
|
||||
type="button"
|
||||
class="btn btn-outline-danger"
|
||||
href="{% url 'account:password_change' %}"
|
||||
>
|
||||
<i class="bi bi-pencil-square"></i> Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,26 @@
|
||||
<div class="container">
|
||||
<h5 class="card-title">Profile</h5>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text"><i class="bi bi-envelope-at"></i></span>
|
||||
<input type="text" class="form-control" placeholder="{{ request.user.email }}" aria-label="Email" disabled readonly>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">First name:</span>
|
||||
<input type="text" class="form-control" placeholder="{{ request.user.first_name }}" aria-label="Username" disabled readonly>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text">Last name:</i></span>
|
||||
<input type="text" class="form-control" placeholder="{{ request.user.last_name }}" aria-label="Email" disabled readonly>
|
||||
</div>
|
||||
<a
|
||||
href="{% url 'account:update_profile' %}"
|
||||
class="btn btn-outline-warning"
|
||||
>
|
||||
<i class="bi bi-pencil-square"></i> Edit
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,12 @@
|
||||
{% extends 'account/profile.html' %}
|
||||
{% load static %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block password_change %}
|
||||
<form method="post">
|
||||
<div class="col-lg-6">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
<p><input class="btn btn-primary" type="submit" value="Change" /></p>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock password_change %}
|
@@ -0,0 +1,11 @@
|
||||
{% extends 'account/profile_info.html' %}
|
||||
{% load static %}
|
||||
{% block profile_alerts %}
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<div class=" d-flex align-items-center mt-1">
|
||||
<h5><i class="bi bi-check-circle-fill"></i> Password changed</h5>
|
||||
</div>
|
||||
Your password has been successfully changed.
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
{% endblock profile_alerts %}
|
17
logs_collector/account/templates/account/profile.html
Normal file
17
logs_collector/account/templates/account/profile.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% extends 'account/base.html' %}
|
||||
{% load static %}
|
||||
{% block title %} {{ title }} {% endblock title %}
|
||||
{% block main %}
|
||||
<div class="container mt-3">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Account:</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{% block profile_info %}{% endblock profile_info %}
|
||||
{% block profile_update %}{% endblock profile_update %}
|
||||
{% block password_change %}{% endblock password_change %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock main %}
|
@@ -0,0 +1,7 @@
|
||||
{% extends 'account/profile.html' %}
|
||||
{% load static %}
|
||||
{% block profile_info %}
|
||||
{% block profile_alerts %}{% endblock profile_alerts %}
|
||||
{% include 'account/includes/auth_credentials.html' %}
|
||||
{% include 'account/includes/profile_credentials.html' %}
|
||||
{% endblock profile_info %}
|
13
logs_collector/account/templates/account/profile_update.html
Normal file
13
logs_collector/account/templates/account/profile_update.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends 'account/profile.html' %}
|
||||
{% load static %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block profile_update %}
|
||||
{% include 'account/includes/auth_credentials.html' %}
|
||||
<div class="container">
|
||||
<h5 class="card-title">Profile</h5>
|
||||
<hr />
|
||||
<div class="row">
|
||||
{% crispy form %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock profile_update %}
|
Reference in New Issue
Block a user