Skip to content
Snippets Groups Projects
Verified Commit 9615b5ff authored by TheJoeCoder's avatar TheJoeCoder
Browse files

Add login and profile templates

parent 6ca4aeaf
No related branches found
No related tags found
No related merge requests found
Showing
with 300 additions and 1 deletion
django-bootstrap5~=24.2
django-gravatar2~=1.4.4
Django~=5.0.7
\ No newline at end of file
......@@ -16,9 +16,11 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
from django.views.generic import TemplateView
urlpatterns = [
path('admin/', admin.site.urls),
path("accounts/", include("django.contrib.auth.urls")),
path("accounts/profile/", TemplateView.as_view(template_name="registration/profile.html"), name="profile"),
path('', include("tcal.urls")),
]
{% extends "base.html" %}
{% block title %}Logged Out{% endblock %}
{% block content %}
<br>
<div class="card">
<div class="card-header">
Message
</div>
<div class="card-body">
You have been logged out. To log back in, <a href="{% url "login" %}">click here</a>.
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Login{% endblock %}
{% block content %}
<br>
{% if form.errors and not form.non_field_errors %}
<div class="alert alert-danger" role="alert">
Please correct the error(s) below.
</div>
{% endif %}
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<div class="alert alert-danger" role="alert">
{{ error }}
</div>
{% endfor %}
{% endif %}
{% if user.is_authenticated %}
<div class="alert alert-danger" role="alert">
You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account?
</div>
{% endif %}
<div class="card">
<div class="card-header">
Login
</div>
<div class="card-body">
{% if form.errors and not form.non_field_errors %}
{% endif %}
<form method="post">
{% csrf_token %}
<div class="mb-3">
{{ form.username.errors }}
<label for="id_username" class="form-label">Username</label>
<input type="text" class="form-control" id="id_username" name="username">
</div>
<div class="mb-3">
{{ form.password.errors }}
<label for="id_password" class="form-label">Password</label>
<input type="password" class="form-control" id="id_password" name="password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
<br>
<div class="card">
<div class="card-header">
Forgotten Password
</div>
<div class="card-body">
<p>If you have forgotten your password, please click <a href="{% url "password_reset" %}">here</a>.</p>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Logged Out{% endblock %}
{% block navbar_items %}
{{ block.super }}
<a class="nav-link active" aria-current="page" href="{% url "profile" %}">Profile</a>
{% endblock %}
{% block content %}
<br>
<div class="card">
<div class="card-header">
Success
</div>
<div class="card-body">
Your password has been changed.
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Change Password{% endblock %}
{% block navbar_items %}
{{ block.super }}
<a class="nav-link active" aria-current="page" href="{% url "profile" %}">Profile</a>
{% endblock %}
{% block content %}
<br>
<div class="card">
<div class="card-header">
Change Password
</div>
<div class="card-body">
{% if form.errors %}
<p class="errornote"><strong>
{% if form.errors.items|length > 1 %}
Please correct the errors below.
{% else %}
Please correct the error below.
{% endif %}
</strong></p>
{% endif %}
<p class="lead">Please enter your old password, for security’s sake, and then enter your new password twice so we can verify you typed it in correctly.</p>
<form method="post">
{% csrf_token %}
<div class="mb-3">
{{ form.old_password.errors }}
<label for="id_old_password" class="form-label">Old Password:</label>
<input type="password" class="form-control" id="id_old_password" name="old_password">
</div>
<div class="mb-3">
{{ form.new_password1.errors }}
<label for="id_new_password1" class="form-label">New Password:</label>
<input type="password" class="form-control" id="id_new_password1" name="new_password1">
</div>
<div class="mb-3">
{{ form.new_password2.errors }}
<label for="id_new_password2" class="form-label">New Password (repeat):</label>
<input type="password" class="form-control" id="id_new_password2" name="new_password2">
</div>
<button type="submit" class="btn btn-primary">Change my password</button>
</form>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Password Reset Complete{% endblock %}
{% block content %}
<br>
<div class="card">
<div class="card-header">
Success
</div>
<div class="card-body">
<p>Your password has been set. You may go ahead and log in now.</p>
<p><a class="btn btn-primary" href="{{ login_url }}">Log in</a></p>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Password Reset{% endblock %}
{% block content %}
<br>
<div class="card">
<div class="card-header">
Password Reset Confirmation
</div>
<div class="card-body">
{% if validlink %}
<p class="lead">Please enter your new password twice, so we can verify you typed it in correctly.</p>
<form method="post">
{% csrf_token %}
<div class="mb-3">
{{ form.new_password1.errors }}
<label for="id_new_password1" class="form-label">New Password</label>
<input type="password" class="form-control" id="id_new_password1" name="new_password1">
</div>
<div class="mb-3">
{{ form.new_password2.errors }}
<label for="id_new_password2" class="form-label">Confirm Password</label>
<input type="password" class="form-control" id="id_new_password2" name="new_password2">
</div>
<button type="submit" class="btn btn-primary">Change password</button>
</form>
{% else %}
<p>The password reset link was invalid, possibly because it has already been used. Please request a new password reset.</p>
{% endif %}
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Logged Out{% endblock %}
{% block content %}
<br>
<div class="card">
<div class="card-header">
Success
</div>
<div class="card-body">
We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.<br>
If you don’t receive an email, please make sure you’ve entered the address you registered with, and check your spam folder.
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "email_base.html" %}
{% block content %}
You're receiving this email because you requested a password reset for your user account at {{ site_name }}.
Please go to the following page and choose a new password:
{% block reset_link %}
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
{% endblock %}
Your username, in case you’ve forgotten: {{ user.get_username }}
Thanks for using our site!
The {{ site_name }} team
{% endblock %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Password Reset{% endblock %}
{% block content %}
<br>
<div class="card">
<div class="card-header">
Password Reset
</div>
<div class="card-body">
<p class="lead">Forgotten your password? Enter your email address below, and we’ll email instructions for setting a new one.</p>
<form method="post">
{% csrf_token %}
<div class="mb-3">
{{ form.email.errors }}
<label for="id_email" class="form-label">Email</label>
<input type="email" class="form-control" id="id_email" name="email" autocomplete="email">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% autoescape off %}
Password reset on {{ site_name }}
{% endautoescape %}
\ No newline at end of file
{% extends "base.html" %}
{% load gravatar %}
{% block title %}Profile{% endblock %}
{% block navbar_items %}
{{ block.super }}
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="{% url "profile" %}">Profile</a>
</li>
{% endblock %}
{% block content %}
<div class="card" id="card-profile">
<div class="card-header">
Profile
</div>
<div class="card-body">
<div class="row">
<div class="col-md-4">
<img src="{% gravatar_url user.email 150 %}" class="rounded-circle mx-auto d-block" alt="Profile image" width="150" height="150">
</div>
<div class="col-md-8">
{% if user.first_name or user.last_name %}
<h3>{{ user.first_name }} {{ user.last_name }}</h3>
{% else %}
<h3>{{ user.username }}</h3>
{% endif %}
<br>
<p><b>Username:</b> {{ user.username }}</p>
<p><b>Primary Email:</b> {{ user.email }}</p>
<p><b>Account Created:</b> {{ user.date_joined }}</p>
<br>
<p><a class="btn btn-primary" href="{% url "password_change" %}">Change Password</a></p>
</div>
</div>
</div>
</div>
<br>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment