diff --git a/.gitignore b/.gitignore index 82ce8452..f4790e10 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ env.py *.sqlite3 settings.json .gitpod.yml -setup.* \ No newline at end of file +setup.* +venv/ +.idea/ \ No newline at end of file diff --git a/accounts/__init__.py b/accounts/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/accounts/admin.py b/accounts/admin.py new file mode 100644 index 00000000..e92c54b9 --- /dev/null +++ b/accounts/admin.py @@ -0,0 +1,20 @@ +from django.contrib import admin + +from .models import Profile + + +class ProfileAdmin(admin.ModelAdmin): + """ + Profile Model Admin Panel setup. + Returning and displaying the three custom fields from the extended + allauth signup form. + """ + fields = ( + 'slack_display_name', + 'user_type', + 'current_lms_module', + ) + + +admin.site.register(Profile, ProfileAdmin) + diff --git a/accounts/apps.py b/accounts/apps.py new file mode 100644 index 00000000..9b3fc5a4 --- /dev/null +++ b/accounts/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class AccountsConfig(AppConfig): + name = 'accounts' diff --git a/accounts/forms.py b/accounts/forms.py new file mode 100644 index 00000000..a84dfa48 --- /dev/null +++ b/accounts/forms.py @@ -0,0 +1,40 @@ +from django import forms +from allauth.account.forms import SignupForm + +from .lists import USER_TYPES_CHOICES, LMS_MODULES_CHOICES + + +class ExtendedSignupForm(SignupForm): + """ + Extending default Django allauth Signup Form to include fields to capture: + - first name/last name/slack display name/user type/current lms module + """ + first_name = forms.CharField(max_length=20) + last_name = forms.CharField(max_length=20) + slack_display_name = forms.CharField(max_length=25) + user_type = forms.ChoiceField( + choices=USER_TYPES_CHOICES + ) + current_lms_module = forms.ChoiceField( + choices=LMS_MODULES_CHOICES + ) + + def __init__(self, *args, **kwargs): + """ + Setting unique attribute of the class instance and calling the parent + class. + Resetting the form autofocus to 'email' as the first displayed field. + """ + super().__init__(*args, **kwargs) + self.fields['email'].widget.attrs['autofocus'] = True + + def custom_signup(self, request, user): + """ + Custom logic to ensure clean data via the form response. + """ + user.first_name = self.cleaned_data["first_name"] + user.last_name = self.cleaned_data["last_name"] + user.slack_display_name = self.cleaned_data["slack_display_name"] + user.user_type = self.cleaned_data["user_type"] + user.current_lms_module = self.cleaned_data["current_lms_module"] + diff --git a/accounts/lists.py b/accounts/lists.py new file mode 100644 index 00000000..12d1a0a5 --- /dev/null +++ b/accounts/lists.py @@ -0,0 +1,28 @@ +# User types list passed into dropdown of same name for user selection used +# in models.py & forms.py +USER_TYPES_CHOICES = [ + ('', 'Select Post Category'), + ('participant', 'Participant'), + ('staff', 'Staff'), + ('admin', 'Admin'), +] + +# LMS Modules list passed into dropdown of same name for user selection used +# in modules.py & forms.py +LMS_MODULES_CHOICES = [ + ('', 'Select Learning Stage'), + ('programme_preliminaries', 'Programme Preliminaries'), + ('programming_paradigms', 'Programming Paradigms'), + ('html_fundamentals', 'HTML Fundamentals'), + ('css_fundamentals', 'CSS Fundamentals'), + ('user_centric_frontend_development', 'User Centric Frontend Development'), + ('javascript_fundamentals', 'Javascript Fundamentals'), + ('interactive_frontend_development', 'Interactive Frontend Development'), + ('python_fundamentals', 'Python Fundamentals'), + ('practical_python', 'Practical Python'), + ('data_centric_development', 'Data Centric Development'), + ('full_stack_frameworks with django', 'Full Stack Frameworks with Django'), + ('alumni', 'Alumni'), + ('staff', 'Staff'), +] + diff --git a/accounts/migrations/0001_initial.py b/accounts/migrations/0001_initial.py new file mode 100644 index 00000000..eade302e --- /dev/null +++ b/accounts/migrations/0001_initial.py @@ -0,0 +1,27 @@ +# Generated by Django 3.1.1 on 2020-10-19 10:01 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Profile', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('slack_display_name', models.CharField(max_length=80, null=True)), + ('user_type', models.CharField(choices=[('', 'Select Post Category'), ('participant', 'Participant'), ('staff', 'Staff'), ('admin', 'Admin')], max_length=20, null=True)), + ('current_lms_module', models.CharField(choices=[('', 'Select Learning Stage'), ('programme preliminaries', 'Programme Preliminaries'), ('programming paradigms', 'Programming Paradigms'), ('html fundamentals', 'HTML Fundamentals'), ('css fundamentals', 'CSS Fundamentals'), ('user centric frontend development', 'User Centric Frontend Development'), ('javascript fundamentals', 'Javascript Fundamentals'), ('interactive frontend development', 'Interactive Frontend Development'), ('python fundamentals', 'Python Fundamentals'), ('practical python', 'Practical Python'), ('data centric development', 'Data Centric Development'), ('full stack frameworks with django', 'Full Stack Frameworks with Django'), ('alumni', 'Alumni'), ('staff', 'Staff')], max_length=35, null=True)), + ('user', models.OneToOneField(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/accounts/migrations/0002_auto_20201020_2042.py b/accounts/migrations/0002_auto_20201020_2042.py new file mode 100644 index 00000000..3eceb93e --- /dev/null +++ b/accounts/migrations/0002_auto_20201020_2042.py @@ -0,0 +1,28 @@ +# Generated by Django 3.1.1 on 2020-10-20 19:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='current_lms_module', + field=models.CharField(choices=[('', 'Select Learning Stage'), ('programme_preliminaries', 'Programme Preliminaries'), ('programming_paradigms', 'Programming Paradigms'), ('html_fundamentals', 'HTML Fundamentals'), ('css_fundamentals', 'CSS Fundamentals'), ('user_centric_frontend_development', 'User Centric Frontend Development'), ('javascript_fundamentals', 'Javascript Fundamentals'), ('interactive_frontend_development', 'Interactive Frontend Development'), ('python_fundamentals', 'Python Fundamentals'), ('practical_python', 'Practical Python'), ('data_centric_development', 'Data Centric Development'), ('full_stack_frameworks with django', 'Full Stack Frameworks with Django'), ('alumni', 'Alumni'), ('staff', 'Staff')], default='', max_length=35), + ), + migrations.AlterField( + model_name='profile', + name='slack_display_name', + field=models.CharField(default='', max_length=80), + ), + migrations.AlterField( + model_name='profile', + name='user_type', + field=models.CharField(choices=[('', 'Select Post Category'), ('participant', 'Participant'), ('staff', 'Staff'), ('admin', 'Admin')], default='', max_length=20), + ), + ] diff --git a/accounts/migrations/__init__.py b/accounts/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/accounts/models.py b/accounts/models.py new file mode 100644 index 00000000..ac3aad9f --- /dev/null +++ b/accounts/models.py @@ -0,0 +1,97 @@ +from django.dispatch import receiver +from django.contrib.auth.models import User +from django.db import models +from django.conf import settings +from django.db.models.signals import post_delete +from allauth.account.signals import user_signed_up + +from .lists import USER_TYPES_CHOICES, LMS_MODULES_CHOICES + + +class Profile(models.Model): + """ + Define Profile Model with OneToOne relationship to AUTH_USER_MODEL and + custom fields to suit Signup Form Extending in forms.py replicating same + in DB. + Using "related_name" in the OneToOne relationship between the two models + specifies the reverse relationship to the User Model, allowing us to + target the custom fields for injection into the profile.html + template via `{{ user.profile.<> }}`. + """ + user = models.OneToOneField( + settings.AUTH_USER_MODEL, default=1, + related_name='profile', + on_delete=models.CASCADE + ) + slack_display_name = models.CharField( + max_length=80, + blank=False, + default='' + ) + user_type = models.CharField( + max_length=20, + blank=False, + default='', + choices=USER_TYPES_CHOICES + ) + current_lms_module = models.CharField( + max_length=35, + blank=False, + default='', + choices=LMS_MODULES_CHOICES + ) + + def save(self, *args, **kwargs): + # when signup takes place + try: + self.slack_display_name = self.user.slack_display_name + self.user_type = self.user.user_type + self.current_lms_module = self.user.current_lms_module + # when saving via admin panel + except KeyError: + self.slack_display_name = self.user.profile.slack_display_name + self.user_type = self.user.profile.user_type + self.current_lms_module = self.user.profile.current_lms_module + + super(Profile, self).save(*args, **kwargs) + + def __str__(self): + """ + Return Class object to string via the user email value + """ + return self.user.email + + +@receiver(user_signed_up) +def user_signed_up(request, user, **kwargs): + """ + Capture server request object in dict from QueryDict, to access form values. + + Iterate over user_type field value to check for type and set permissions + based on user story and save user to User and Profile Models. + """ + form = dict(request.POST) + + if form['user_type'][0] == 'participant': + user.is_active = True + elif form['user_type'][0] == 'staff': + user.is_active = False + user.is_staff = True + else: + user.is_active = False + user.is_staff = True + user.is_superuser = True + user.save() + + # Save linked instance of user object to profile model + Profile.objects.create(user=user) + + +@receiver(post_delete, sender=Profile) +def post_delete_user(sender, instance, *args, **kwargs): + """ + admin - delete user at same time as profile deletion + """ + if instance: + instance.user.delete() + diff --git a/accounts/tests.py b/accounts/tests.py new file mode 100644 index 00000000..2e9cb5f6 --- /dev/null +++ b/accounts/tests.py @@ -0,0 +1 @@ +from django.test import TestCase diff --git a/accounts/views.py b/accounts/views.py new file mode 100644 index 00000000..2536b376 --- /dev/null +++ b/accounts/views.py @@ -0,0 +1 @@ +from django.shortcuts import render diff --git a/hackathon/migrations/0001_initial.py b/hackathon/migrations/0001_initial.py index 117b5d58..d399594b 100644 --- a/hackathon/migrations/0001_initial.py +++ b/hackathon/migrations/0001_initial.py @@ -30,4 +30,4 @@ class Migration(migrations.Migration): ('organiser', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hackathon_organiser', to=settings.AUTH_USER_MODEL)), ], ), - ] + ] \ No newline at end of file diff --git a/hackathon/migrations/0002_auto_20201015_1936.py b/hackathon/migrations/0002_auto_20201015_1936.py index c5e81fef..ce61ee5d 100644 --- a/hackathon/migrations/0002_auto_20201015_1936.py +++ b/hackathon/migrations/0002_auto_20201015_1936.py @@ -30,4 +30,4 @@ class Migration(migrations.Migration): ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hackawardcategory_created_by', to=settings.AUTH_USER_MODEL)), ], ), - ] + ] \ No newline at end of file diff --git a/hackathon/migrations/0003_auto_20201015_2020.py b/hackathon/migrations/0003_auto_20201015_2020.py index 49c4537f..298b217c 100644 --- a/hackathon/migrations/0003_auto_20201015_2020.py +++ b/hackathon/migrations/0003_auto_20201015_2020.py @@ -44,4 +44,4 @@ class Migration(migrations.Migration): ('mentor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hackproject_mentor', to=settings.AUTH_USER_MODEL)), ], ), - ] + ] \ No newline at end of file diff --git a/hackathon/migrations/0004_auto_20201015_2224.py b/hackathon/migrations/0004_auto_20201015_2224.py index 1a3d1081..7d737e62 100644 --- a/hackathon/migrations/0004_auto_20201015_2224.py +++ b/hackathon/migrations/0004_auto_20201015_2224.py @@ -62,4 +62,4 @@ class Migration(migrations.Migration): ('score', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='hackathon.hackprojectscorecategory')), ], ), - ] + ] \ No newline at end of file diff --git a/hackathon/migrations/0005_auto_20201016_1951.py b/hackathon/migrations/0005_auto_20201016_1951.py index 00a23f97..15668605 100644 --- a/hackathon/migrations/0005_auto_20201016_1951.py +++ b/hackathon/migrations/0005_auto_20201016_1951.py @@ -73,4 +73,4 @@ class Migration(migrations.Migration): name='created', field=models.DateTimeField(auto_now_add=True), ), - ] + ] \ No newline at end of file diff --git a/hackathon/migrations/0006_auto_20201016_2050.py b/hackathon/migrations/0006_auto_20201016_2050.py index ccd0d5ac..14216dc3 100644 --- a/hackathon/migrations/0006_auto_20201016_2050.py +++ b/hackathon/migrations/0006_auto_20201016_2050.py @@ -15,4 +15,4 @@ class Migration(migrations.Migration): old_name='hackprojectscorecategory', new_name='hack_project_score_category', ), - ] + ] \ No newline at end of file diff --git a/hackathon/migrations/0007_auto_20201017_1148.py b/hackathon/migrations/0007_auto_20201017_1148.py index 0144e456..17656072 100644 --- a/hackathon/migrations/0007_auto_20201017_1148.py +++ b/hackathon/migrations/0007_auto_20201017_1148.py @@ -38,4 +38,4 @@ class Migration(migrations.Migration): name='created_by', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hackteams', to=settings.AUTH_USER_MODEL), ), - ] + ] \ No newline at end of file diff --git a/hackathon/migrations/0008_hackprojectscorecategory_highest_score.py b/hackathon/migrations/0008_hackprojectscorecategory_highest_score.py index a6b14d9e..7f1ebfff 100644 --- a/hackathon/migrations/0008_hackprojectscorecategory_highest_score.py +++ b/hackathon/migrations/0008_hackprojectscorecategory_highest_score.py @@ -15,4 +15,4 @@ class Migration(migrations.Migration): name='highest_score', field=models.IntegerField(default=10), ), - ] + ] \ No newline at end of file diff --git a/hackathon/migrations/0009_auto_20201018_1829.py b/hackathon/migrations/0009_auto_20201018_1829.py index c5a2ed8a..a4ddbe5a 100644 --- a/hackathon/migrations/0009_auto_20201018_1829.py +++ b/hackathon/migrations/0009_auto_20201018_1829.py @@ -20,4 +20,4 @@ class Migration(migrations.Migration): name='min_score', field=models.IntegerField(default=1), ), - ] + ] \ No newline at end of file diff --git a/main/settings.py b/main/settings.py index c2024e4a..8a28f186 100644 --- a/main/settings.py +++ b/main/settings.py @@ -27,6 +27,7 @@ "allauth.account", "allauth.socialaccount", "home", + 'accounts', "profiles", "crispy_forms", # M05 App "Hackathon" added @@ -81,6 +82,18 @@ SITE_ID = 1 +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + +ACCOUNT_FORMS = {'signup': 'accounts.forms.ExtendedSignupForm'} +ACCOUNT_USERNAME_REQUIRED = False +ACCOUNT_AUTHENTICATION_METHOD = 'email' +ACCOUNT_EMAIL_REQUIRED = True +ACCOUNT_EMAIL_VERIFICATION = 'mandatory' +ACCOUNT_SIGNUP_EMAIL_ENTER_TWICE = True +ACCOUNT_USERNAME_MIN_LENGTH = 4 +LOGIN_URL = '/accounts/login/' +LOGIN_REDIRECT_URL = '/' + WSGI_APPLICATION = "main.wsgi.application" diff --git a/templates/allauth/account/account_inactive.html b/templates/allauth/account/account_inactive.html new file mode 100644 index 00000000..4831310e --- /dev/null +++ b/templates/allauth/account/account_inactive.html @@ -0,0 +1,10 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Account Inactive" %}{% endblock %} + +{% block content %} +

{% trans "Account Inactive" %}

+

{% trans "This account is inactive." %}

+{% endblock %} diff --git a/templates/allauth/account/base.html b/templates/allauth/account/base.html new file mode 100644 index 00000000..94d9808c --- /dev/null +++ b/templates/allauth/account/base.html @@ -0,0 +1 @@ +{% extends "base.html" %} diff --git a/templates/allauth/account/email.html b/templates/allauth/account/email.html new file mode 100644 index 00000000..00b09099 --- /dev/null +++ b/templates/allauth/account/email.html @@ -0,0 +1,71 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "E-mail Addresses" %}{% endblock %} + +{% block content %} +

{% trans "E-mail Addresses" %}

+ {% if user.emailaddress_set.all %} +

+ {% trans 'The following e-mail addresses are associated with your account:' %} +

+
+ {% csrf_token %} +
+ {% for emailaddress in user.emailaddress_set.all %} +
+ +
+ {% endfor %} + +
+ + + +
+ +
+
+ + {% else %} +

+ {% trans 'Warning:' %} {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %} +

+ {% endif %} + +

{% trans "Add E-mail Address" %}

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} + +{% block extra_body %} + +{% endblock %} diff --git a/templates/allauth/account/email/email_confirmation_message.txt b/templates/allauth/account/email/email_confirmation_message.txt new file mode 100644 index 00000000..c3fc2b57 --- /dev/null +++ b/templates/allauth/account/email/email_confirmation_message.txt @@ -0,0 +1,20 @@ +{% load account %} + +{% user_display user as user_display %} + +{% load i18n %} + +{% autoescape off %} + +{% blocktrans with site_name=current_site.name site_domain=current_site.domain %} +Hello from {{ site_name }}! +You're receiving this e-mail because user {{ user_display }} has given yours as an e-mail address to connect their account. +To confirm this is correct, go to {{ activate_url }} +{% endblocktrans %} + +{% blocktrans with site_name=current_site.name site_domain=current_site.domain %} +Thank you from {{ site_name }}! +{{ site_domain }} +{% endblocktrans %} + +{% endautoescape %} diff --git a/templates/allauth/account/email/email_confirmation_signup_message.txt b/templates/allauth/account/email/email_confirmation_signup_message.txt new file mode 100644 index 00000000..9996f7e5 --- /dev/null +++ b/templates/allauth/account/email/email_confirmation_signup_message.txt @@ -0,0 +1 @@ +{% include "account/email/email_confirmation_message.txt" %} diff --git a/templates/allauth/account/email/email_confirmation_signup_subject.txt b/templates/allauth/account/email/email_confirmation_signup_subject.txt new file mode 100644 index 00000000..4c85ebb9 --- /dev/null +++ b/templates/allauth/account/email/email_confirmation_signup_subject.txt @@ -0,0 +1 @@ +{% include "account/email/email_confirmation_subject.txt" %} diff --git a/templates/allauth/account/email/email_confirmation_subject.txt b/templates/allauth/account/email/email_confirmation_subject.txt new file mode 100644 index 00000000..b0a876f5 --- /dev/null +++ b/templates/allauth/account/email/email_confirmation_subject.txt @@ -0,0 +1,4 @@ +{% load i18n %} +{% autoescape off %} +{% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %} +{% endautoescape %} diff --git a/templates/allauth/account/email/password_reset_key_message.txt b/templates/allauth/account/email/password_reset_key_message.txt new file mode 100644 index 00000000..4e39b43a --- /dev/null +++ b/templates/allauth/account/email/password_reset_key_message.txt @@ -0,0 +1,24 @@ +{% load i18n %} + +{% autoescape off %} + +{% blocktrans with site_name=current_site.name site_domain=current_site.domain %} +Hello from {{ site_name }}! +You're receiving this e-mail because you or someone else has requested a password for your user account. +It can be safely ignored if you did not request a password reset. Click the link below to reset your password. +{% endblocktrans %} + +{{ password_reset_url }} + +{% if username %} +{% blocktrans %} +In case you forgot, your username is {{ username }}. +{% endblocktrans %} +{% endif %} + +{% blocktrans with site_name=current_site.name site_domain=current_site.domain %} +Thank you for using {{ site_name }}! +{{ site_domain }} +{% endblocktrans %} + +{% endautoescape %} diff --git a/templates/allauth/account/email/password_reset_key_subject.txt b/templates/allauth/account/email/password_reset_key_subject.txt new file mode 100644 index 00000000..6857d700 --- /dev/null +++ b/templates/allauth/account/email/password_reset_key_subject.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% autoescape off %} +{% blocktrans %}Password Reset E-mail{% endblocktrans %} +{% endautoescape %} diff --git a/templates/allauth/account/email_confirm.html b/templates/allauth/account/email_confirm.html new file mode 100644 index 00000000..a1e88c67 --- /dev/null +++ b/templates/allauth/account/email_confirm.html @@ -0,0 +1,23 @@ +{% extends "account/base.html" %} + +{% load i18n %} +{% load account %} + +{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %} + +{% block content %} +

{% trans "Confirm E-mail Address" %}

+ {% if confirmation %} + {% user_display confirmation.email_address.user as user_display %} +

{% blocktrans with confirmation.email_address.email as email %}Please confirm that {{ email }} is an e-mail address + for user {{ user_display }}.{% endblocktrans %}

+
+ {% csrf_token %} + +
+ {% else %} + {% url 'account_email' as email_url %} +

{% blocktrans %}This e-mail confirmation link expired or is invalid. Please issue a new e-mail confirmation request + .{% endblocktrans %}

+ {% endif %} +{% endblock %} diff --git a/templates/allauth/account/login.html b/templates/allauth/account/login.html new file mode 100644 index 00000000..1ad77536 --- /dev/null +++ b/templates/allauth/account/login.html @@ -0,0 +1,43 @@ +{% extends "account/base.html" %} + +{% load i18n %} +{% load account socialaccount %} + +{% block head_title %}{% trans "Sign In" %}{% endblock %} + +{% block content %} + +

{% trans "Sign In" %}

+ + {% get_providers as socialaccount_providers %} + + {% if socialaccount_providers %} +

{% blocktrans with site.name as site_name %}Please sign in with one + of your existing third party accounts. Or, sign up + for a {{ site_name }} account and sign in below:{% endblocktrans %} +

+
+ + +
+ + {% include "socialaccount/snippets/login_extra.html" %} + + {% else %} +

{% blocktrans %}If you have not created an account yet, then please + sign up first.{% endblocktrans %}

+ {% endif %} + +
+ {% csrf_token %} + {{ form.as_p }} + {% if redirect_field_value %} + + {% endif %} + {% trans "Forgot Password?" %} + +
+ +{% endblock %} diff --git a/templates/allauth/account/logout.html b/templates/allauth/account/logout.html new file mode 100644 index 00000000..9c362f98 --- /dev/null +++ b/templates/allauth/account/logout.html @@ -0,0 +1,19 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Sign Out" %}{% endblock %} + +{% block content %} +

{% trans "Sign Out" %}

+

{% trans 'Are you sure you want to sign out?' %}

+ +
+ {% csrf_token %} + {% if redirect_field_value %} + + {% endif %} + +
+ +{% endblock %} diff --git a/templates/allauth/account/messages/cannot_delete_primary_email.txt b/templates/allauth/account/messages/cannot_delete_primary_email.txt new file mode 100644 index 00000000..0965e23a --- /dev/null +++ b/templates/allauth/account/messages/cannot_delete_primary_email.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +You cannot remove your primary e-mail address ({{email}}). +{% endblocktrans %} diff --git a/templates/allauth/account/messages/email_confirmation_sent.txt b/templates/allauth/account/messages/email_confirmation_sent.txt new file mode 100644 index 00000000..ddb9838b --- /dev/null +++ b/templates/allauth/account/messages/email_confirmation_sent.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +Confirmation e-mail sent to {{email}}. +{% endblocktrans %} diff --git a/templates/allauth/account/messages/email_confirmed.txt b/templates/allauth/account/messages/email_confirmed.txt new file mode 100644 index 00000000..a0ace37c --- /dev/null +++ b/templates/allauth/account/messages/email_confirmed.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +You have confirmed {{email}}. +{% endblocktrans %} diff --git a/templates/allauth/account/messages/email_deleted.txt b/templates/allauth/account/messages/email_deleted.txt new file mode 100644 index 00000000..e189dd9c --- /dev/null +++ b/templates/allauth/account/messages/email_deleted.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +Removed e-mail address {{email}}. +{% endblocktrans %} diff --git a/templates/allauth/account/messages/logged_in.txt b/templates/allauth/account/messages/logged_in.txt new file mode 100644 index 00000000..ae1f5d86 --- /dev/null +++ b/templates/allauth/account/messages/logged_in.txt @@ -0,0 +1,9 @@ +{% load account %} + +{% load i18n %} + +{% user_display user as name %} + +{% blocktrans %} +Successfully signed in as {{name}}. +{% endblocktrans %} diff --git a/templates/allauth/account/messages/logged_out.txt b/templates/allauth/account/messages/logged_out.txt new file mode 100644 index 00000000..8f9852ec --- /dev/null +++ b/templates/allauth/account/messages/logged_out.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +You have signed out. +{% endblocktrans %} diff --git a/templates/allauth/account/messages/password_changed.txt b/templates/allauth/account/messages/password_changed.txt new file mode 100644 index 00000000..fee92f31 --- /dev/null +++ b/templates/allauth/account/messages/password_changed.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +Password successfully changed. +{% endblocktrans %} diff --git a/templates/allauth/account/messages/password_set.txt b/templates/allauth/account/messages/password_set.txt new file mode 100644 index 00000000..fbc7fe10 --- /dev/null +++ b/templates/allauth/account/messages/password_set.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +Password successfully set. +{% endblocktrans %} diff --git a/templates/allauth/account/messages/primary_email_set.txt b/templates/allauth/account/messages/primary_email_set.txt new file mode 100644 index 00000000..d0c815b7 --- /dev/null +++ b/templates/allauth/account/messages/primary_email_set.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +Primary e-mail address set. +{% endblocktrans %} diff --git a/templates/allauth/account/messages/unverified_primary_email.txt b/templates/allauth/account/messages/unverified_primary_email.txt new file mode 100644 index 00000000..d401af7d --- /dev/null +++ b/templates/allauth/account/messages/unverified_primary_email.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +Your primary e-mail address must be verified. +{% endblocktrans %} diff --git a/templates/allauth/account/password_change.html b/templates/allauth/account/password_change.html new file mode 100644 index 00000000..b5365791 --- /dev/null +++ b/templates/allauth/account/password_change.html @@ -0,0 +1,15 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Change Password" %}{% endblock %} + +{% block content %} +

{% trans "Change Password" %}

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} diff --git a/templates/allauth/account/password_reset.html b/templates/allauth/account/password_reset.html new file mode 100644 index 00000000..b6f0791e --- /dev/null +++ b/templates/allauth/account/password_reset.html @@ -0,0 +1,22 @@ +{% extends "account/base.html" %} + +{% load i18n %} +{% load account %} + +{% block head_title %}{% trans "Password Reset" %}{% endblock %} + +{% block content %} +

{% trans "Password Reset" %}

+ {% if user.is_authenticated %} + {% include "account/snippets/already_logged_in.html" %} + {% endif %} +

{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+ +

{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

+{% endblock %} diff --git a/templates/allauth/account/password_reset_done.html b/templates/allauth/account/password_reset_done.html new file mode 100644 index 00000000..16cfffc4 --- /dev/null +++ b/templates/allauth/account/password_reset_done.html @@ -0,0 +1,15 @@ +{% extends "account/base.html" %} + +{% load i18n %} +{% load account %} + +{% block head_title %}{% trans "Password Reset" %}{% endblock %} + +{% block content %} +

{% trans "Password Reset" %}

+ {% if user.is_authenticated %} + {% include "account/snippets/already_logged_in.html" %} + {% endif %} + +

{% blocktrans %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktrans %}

+{% endblock %} diff --git a/templates/allauth/account/password_reset_from_key.html b/templates/allauth/account/password_reset_from_key.html new file mode 100644 index 00000000..4862683d --- /dev/null +++ b/templates/allauth/account/password_reset_from_key.html @@ -0,0 +1,24 @@ +{% extends "account/base.html" %} + +{% load i18n %} +{% block head_title %}{% trans "Change Password" %}{% endblock %} + +{% block content %} +

{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}

+ + {% if token_fail %} + {% url 'account_reset_password' as passwd_reset_url %} +

{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a + new password reset.{% endblocktrans %}

+ {% else %} + {% if form %} +
+ {% csrf_token %} + {{ form.as_p }} + +
+ {% else %} +

{% trans 'Your password is now changed.' %}

+ {% endif %} + {% endif %} +{% endblock %} diff --git a/templates/allauth/account/password_reset_from_key_done.html b/templates/allauth/account/password_reset_from_key_done.html new file mode 100644 index 00000000..85641c2e --- /dev/null +++ b/templates/allauth/account/password_reset_from_key_done.html @@ -0,0 +1,9 @@ +{% extends "account/base.html" %} + +{% load i18n %} +{% block head_title %}{% trans "Change Password" %}{% endblock %} + +{% block content %} +

{% trans "Change Password" %}

+

{% trans 'Your password is now changed.' %}

+{% endblock %} diff --git a/templates/allauth/account/password_set.html b/templates/allauth/account/password_set.html new file mode 100644 index 00000000..f5615720 --- /dev/null +++ b/templates/allauth/account/password_set.html @@ -0,0 +1,15 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Set Password" %}{% endblock %} + +{% block content %} +

{% trans "Set Password" %}

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} diff --git a/templates/allauth/account/signup.html b/templates/allauth/account/signup.html new file mode 100644 index 00000000..2e3b9dcb --- /dev/null +++ b/templates/allauth/account/signup.html @@ -0,0 +1,20 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Signup" %}{% endblock %} + +{% block content %} +

{% trans "Sign Up" %}

+

{% blocktrans %}Already have an account? Then please sign in.{% endblocktrans %}

+ +
+ {% csrf_token %} + {{ form.as_p }} + {% if redirect_field_value %} + + {% endif %} + +
+ +{% endblock %} diff --git a/templates/allauth/account/signup_closed.html b/templates/allauth/account/signup_closed.html new file mode 100644 index 00000000..af258d1b --- /dev/null +++ b/templates/allauth/account/signup_closed.html @@ -0,0 +1,10 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} + +{% block content %} +

{% trans "Sign Up Closed" %}

+

{% trans "We are sorry, but the sign up is currently closed." %}

+{% endblock %} diff --git a/templates/allauth/account/snippets/already_logged_in.html b/templates/allauth/account/snippets/already_logged_in.html new file mode 100644 index 00000000..30a8ce1b --- /dev/null +++ b/templates/allauth/account/snippets/already_logged_in.html @@ -0,0 +1,7 @@ +{% load i18n %} +{% load account %} + +{% user_display user as user_display %} +

+ {% trans "Note" %}: {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %} +

diff --git a/templates/allauth/account/verification_sent.html b/templates/allauth/account/verification_sent.html new file mode 100644 index 00000000..a7c3d16b --- /dev/null +++ b/templates/allauth/account/verification_sent.html @@ -0,0 +1,12 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} + +{% block content %} +

{% trans "Verify Your E-mail Address" %}

+

{% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not + receive it within a few minutes.{% endblocktrans %}

+ +{% endblock %} diff --git a/templates/allauth/account/verified_email_required.html b/templates/allauth/account/verified_email_required.html new file mode 100644 index 00000000..9d8ab04a --- /dev/null +++ b/templates/allauth/account/verified_email_required.html @@ -0,0 +1,21 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} + +{% block content %} +

{% trans "Verify Your E-mail Address" %}

+ {% url 'account_email' as email_url %} +

{% blocktrans %}This part of the site requires us to verify that + you are who you claim to be. For this purpose, we require that you + verify ownership of your e-mail address. {% endblocktrans %} +

+

{% blocktrans %}We have sent an e-mail to you for + verification. Please click on the link inside this e-mail. Please + contact us if you do not receive it within a few minutes.{% endblocktrans %} +

+

{% blocktrans %}Note: you can still change your e-mail address.{% endblocktrans %} +

+ +{% endblock %} diff --git a/templates/allauth/base.html b/templates/allauth/base.html new file mode 100644 index 00000000..4138b2e6 --- /dev/null +++ b/templates/allauth/base.html @@ -0,0 +1,42 @@ + + + + {% block head_title %}{% endblock %} + {% block extra_head %} + {% endblock %} + + + {% block body %} + + {% if messages %} +
+ Messages: + +
+ {% endif %} + +
+ Menu: + +
+ + {% block content %} + {% endblock %} + + {% endblock %} + {% block extra_body %} + {% endblock %} + + diff --git a/templates/allauth/socialaccount/authentication_error.html b/templates/allauth/socialaccount/authentication_error.html new file mode 100644 index 00000000..a936d769 --- /dev/null +++ b/templates/allauth/socialaccount/authentication_error.html @@ -0,0 +1,10 @@ +{% extends "socialaccount/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Social Network Login Failure" %}{% endblock %} + +{% block content %} +

{% trans "Social Network Login Failure" %}

+

{% trans "An error occurred while attempting to login via your social network account." %}

+{% endblock %} diff --git a/templates/allauth/socialaccount/base.html b/templates/allauth/socialaccount/base.html new file mode 100644 index 00000000..b64fd563 --- /dev/null +++ b/templates/allauth/socialaccount/base.html @@ -0,0 +1 @@ +{% extends "account/base.html" %} diff --git a/templates/allauth/socialaccount/connections.html b/templates/allauth/socialaccount/connections.html new file mode 100644 index 00000000..939291da --- /dev/null +++ b/templates/allauth/socialaccount/connections.html @@ -0,0 +1,50 @@ +{% extends "socialaccount/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Account Connections" %}{% endblock %} + +{% block content %} +

{% trans "Account Connections" %}

+ {% if form.accounts %} +

{% blocktrans %}You can sign in to your account using any of the following third party accounts:{% endblocktrans %}

+ +
+ {% csrf_token %} + +
+ {% if form.non_field_errors %} +
{{ form.non_field_errors }}
+ {% endif %} + + {% for base_account in form.accounts %} + {% with base_account.get_provider_account as account %} +
+ +
+ {% endwith %} + {% endfor %} + +
+ +
+
+
+ + {% else %} +

{% trans 'You currently have no social network accounts connected to this account.' %}

+ {% endif %} + +

{% trans 'Add a 3rd Party Account' %}

+ + + + {% include "socialaccount/snippets/login_extra.html" %} + +{% endblock %} diff --git a/templates/allauth/socialaccount/login_cancelled.html b/templates/allauth/socialaccount/login_cancelled.html new file mode 100644 index 00000000..50b9a361 --- /dev/null +++ b/templates/allauth/socialaccount/login_cancelled.html @@ -0,0 +1,12 @@ +{% extends "socialaccount/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Login Cancelled" %}{% endblock %} + +{% block content %} +

{% trans "Login Cancelled" %}

+ {% url 'account_login' as login_url %} +

{% blocktrans %}You decided to cancel logging in to our site using one of your existing accounts. If this was a mistake, please proceed to + sign in.{% endblocktrans %}

+{% endblock %} diff --git a/templates/allauth/socialaccount/messages/account_connected.txt b/templates/allauth/socialaccount/messages/account_connected.txt new file mode 100644 index 00000000..b3760093 --- /dev/null +++ b/templates/allauth/socialaccount/messages/account_connected.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +The social account has been connected. +{% endblocktrans %} diff --git a/templates/allauth/socialaccount/messages/account_connected_other.txt b/templates/allauth/socialaccount/messages/account_connected_other.txt new file mode 100644 index 00000000..635bab26 --- /dev/null +++ b/templates/allauth/socialaccount/messages/account_connected_other.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +The social account is already connected to a different account. +{% endblocktrans %} diff --git a/templates/allauth/socialaccount/messages/account_connected_updated.txt b/templates/allauth/socialaccount/messages/account_connected_updated.txt new file mode 100644 index 00000000..3f7174e8 --- /dev/null +++ b/templates/allauth/socialaccount/messages/account_connected_updated.txt @@ -0,0 +1 @@ +{% extends "socialaccount/messages/account_connected.txt" %} diff --git a/templates/allauth/socialaccount/messages/account_disconnected.txt b/templates/allauth/socialaccount/messages/account_disconnected.txt new file mode 100644 index 00000000..60a71386 --- /dev/null +++ b/templates/allauth/socialaccount/messages/account_disconnected.txt @@ -0,0 +1,5 @@ +{% load i18n %} + +{% blocktrans %} +The social account has been disconnected. +{% endblocktrans %} diff --git a/templates/allauth/socialaccount/signup.html b/templates/allauth/socialaccount/signup.html new file mode 100644 index 00000000..1d150146 --- /dev/null +++ b/templates/allauth/socialaccount/signup.html @@ -0,0 +1,21 @@ +{% extends "socialaccount/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Signup" %}{% endblock %} + +{% block content %} +

{% trans "Sign Up" %}

+

{% blocktrans with provider_name=account.get_provider.name site_name=site.name %}You are about to use your {{ provider_name }} account to login to + {{ site_name }}. As a final step, please complete the following form:{% endblocktrans %}

+ +
+ {% csrf_token %} + {{ form.as_p }} + {% if redirect_field_value %} + + {% endif %} + +
+ +{% endblock %} diff --git a/templates/allauth/socialaccount/snippets/login_extra.html b/templates/allauth/socialaccount/snippets/login_extra.html new file mode 100644 index 00000000..307def40 --- /dev/null +++ b/templates/allauth/socialaccount/snippets/login_extra.html @@ -0,0 +1,3 @@ +{% load socialaccount %} + +{% providers_media_js %} diff --git a/templates/allauth/socialaccount/snippets/provider_list.html b/templates/allauth/socialaccount/snippets/provider_list.html new file mode 100644 index 00000000..33afe9ac --- /dev/null +++ b/templates/allauth/socialaccount/snippets/provider_list.html @@ -0,0 +1,20 @@ +{% load socialaccount %} + +{% get_providers as socialaccount_providers %} + +{% for provider in socialaccount_providers %} + {% if provider.id == "openid" %} + {% for brand in provider.get_brands %} +
  • + {{ brand.name }} +
  • + {% endfor %} + {% endif %} +
  • + {{ provider.name }} +
  • +{% endfor %}