diff --git a/breccia_mapper/account_adapter.py b/breccia_mapper/account_adapter.py new file mode 100644 index 0000000..2d03265 --- /dev/null +++ b/breccia_mapper/account_adapter.py @@ -0,0 +1,16 @@ +from allauth.account.adapter import DefaultAccountAdapter +from constance import config + + +class ControlSignupsAccountAdapter(DefaultAccountAdapter): + + def is_open_for_signup(self, request): + """ + Checks whether or not the site is open for signups. + + Next to simply returning True/False you can also intervene the + regular flow by raising an ImmediateHttpResponse + + (Comment reproduced from the overridden method.) + """ + return config.ALLOW_SIGNUPS diff --git a/breccia_mapper/settings.py b/breccia_mapper/settings.py index d5c4e21..16169b4 100644 --- a/breccia_mapper/settings.py +++ b/breccia_mapper/settings.py @@ -185,6 +185,7 @@ DJANGO_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django.contrib.sites', ] THIRD_PARTY_APPS = [ @@ -199,6 +200,12 @@ THIRD_PARTY_APPS = [ 'bootstrap_datepicker_plus', 'hijack', 'pwa', + 'allauth', + 'allauth.account', + 'allauth.socialaccount', + 'allauth.socialaccount.providers.google', + 'allauth.socialaccount.providers.microsoft', + 'django_inlinecss', ] FIRST_PARTY_APPS = [ @@ -219,6 +226,11 @@ MIDDLEWARE = [ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'hijack.middleware.HijackUserMiddleware', + 'django.contrib.sites.middleware.CurrentSiteMiddleware', +] + +FIXTURE_DIRS = [ + BASE_DIR.joinpath('breccia_mapper', 'fixtures'), ] ROOT_URLCONF = 'breccia_mapper.urls' @@ -243,6 +255,33 @@ TEMPLATES = [ WSGI_APPLICATION = 'breccia_mapper.wsgi.application' +# allauth +AUTHENTICATION_BACKENDS = [ + # Needed to login by username in Django admin, regardless of `allauth` + 'django.contrib.auth.backends.ModelBackend', + # `allauth` specific authentication methods, such as login by email + 'allauth.account.auth_backends.AuthenticationBackend', +] +SITE_ID = 1 +ACCOUNT_DEFAULT_HTTP_PROTOCOL = SITE_PROTOCOL +ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 1 +ACCOUNT_EMAIL_REQUIRED = True +ACCOUNT_EMAIL_VERIFICATION = "mandatory" +ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5 +# 1 day +ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = 86400 +# or any other page +ACCOUNT_LOGOUT_REDIRECT_URL = '/' +ACCOUNT_ADAPTER = 'breccia_mapper.account_adapter.ControlSignupsAccountAdapter' + + +PROJECT_LONG_NAME = config('PROJECT_LONG_NAME', 'Project Network Mapper') +PROJECT_SHORT_NAME = config('PROJECT_SHORT_NAME', 'Network Mapper') +PROJECT_DESCRIPTION = config('PROJECT_DESCRIPTION', 'Application to map network relationships in the organisation.') +THEME_COLOR = '#' + config('THEME_COLOR', '212121') +BACKGROUND_COLOR = '#' + config('BACKGROUND_COLOR', 'ffffff') + + # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases @@ -303,7 +342,7 @@ AUTH_USER_MODEL = 'people.User' # Login flow -LOGIN_URL = reverse_lazy('login') +LOGIN_URL = reverse_lazy('account_login') LOGIN_REDIRECT_URL = reverse_lazy('people:person.profile') @@ -408,6 +447,15 @@ CONSTANCE_CONFIG = { 'PROJECT_TAGLINE': ( 'Here is your project\'s tagline.', 'Project tagline'), + 'ALLOW_SIGNUPS': ( + False, + 'Allow new users to sign up using the site\'s sign up form'), + 'ENABLE_GOOGLE_LOGIN': ( + False, + 'Allow users to sign in using their Google accounts'), + 'ENABLE_MICROSOFT_LOGIN': ( + False, + 'Allow users to sign in using their Microsoft accounts'), 'HOMEPAGE_HEADER_IMAGE': ( '800x500.png', 'Homepage header image', @@ -459,6 +507,9 @@ CONSTANCE_CONFIG_FIELDSETS = { 'PARENT_PROJECT_NAME', 'PROJECT_LEAD', 'PROJECT_TAGLINE', + 'ALLOW_SIGNUPS', + 'ENABLE_GOOGLE_LOGIN', + 'ENABLE_MICROSOFT_LOGIN', ), 'Homepage configuration': ( 'HOMEPAGE_HEADER_IMAGE_SHRINK', @@ -492,12 +543,6 @@ CONSTANCE_CONFIG_FIELDSETS = { CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend' -PROJECT_LONG_NAME = config('PROJECT_LONG_NAME', 'Project Network Mapper') -PROJECT_SHORT_NAME = config('PROJECT_SHORT_NAME', 'Network Mapper') -PROJECT_DESCRIPTION = config('PROJECT_DESCRIPTION', 'Application to map network relationships in the organisation.') -THEME_COLOR = '#' + config('THEME_COLOR', '212121') -BACKGROUND_COLOR = '#' + config('BACKGROUND_COLOR', 'ffffff') - # Django Hijack settings # See https://django-hijack.readthedocs.io/en/stable/ diff --git a/breccia_mapper/static/css/emails.css b/breccia_mapper/static/css/emails.css new file mode 100644 index 0000000..e35e8bf --- /dev/null +++ b/breccia_mapper/static/css/emails.css @@ -0,0 +1,303 @@ +/* ------------------------------------- + GLOBAL + A very basic CSS reset +------------------------------------- */ +* { + margin: 0; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; + box-sizing: border-box; + font-size: 14px; +} + +img { + max-width: 100%; +} + +body { + -webkit-font-smoothing: antialiased; + -webkit-text-size-adjust: none; + width: 100% !important; + height: 100%; + line-height: 1.6em; + /* 1.6em * 14px = 22.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ + /*line-height: 22px;*/ +} + +/* Let's make sure all tables have defaults */ +table td { + vertical-align: top; +} + +/* ------------------------------------- + BODY & CONTAINER +------------------------------------- */ +body { + background-color: #f6f6f6; +} + +.body-wrap { + background-color: #f6f6f6; + width: 100%; +} + +.container { + display: block !important; + max-width: 600px !important; + margin: 0 auto !important; + /* makes it centered */ + clear: both !important; +} + +.content { + max-width: 600px; + margin: 0 auto; + display: block; + padding: 20px; +} + +/* ------------------------------------- + HEADER, FOOTER, MAIN +------------------------------------- */ +.main { + background-color: #fff; + border: 1px solid #e9e9e9; + border-radius: 3px; +} + +.content-wrap { + padding: 20px; +} + +.content-block { + padding: 0 0 20px; +} + +.header { + width: 100%; + margin-bottom: 20px; +} + +.footer { + width: 100%; + clear: both; + color: #999; + padding: 20px; +} + +.footer p, +.footer a, +.footer td { + color: #999; + font-size: 12px; +} + +/* ------------------------------------- + TYPOGRAPHY +------------------------------------- */ +h1, +h2, +h3 { + font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; + color: #000; + margin: 40px 0 0; + line-height: 1.2em; + font-weight: 400; +} + +h1 { + font-size: 32px; + font-weight: 500; + /* 1.2em * 32px = 38.4px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ + /*line-height: 38px;*/ +} + +h2 { + font-size: 24px; + /* 1.2em * 24px = 28.8px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ + /*line-height: 29px;*/ +} + +h3 { + font-size: 18px; + /* 1.2em * 18px = 21.6px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ + /*line-height: 22px;*/ +} + +h4 { + font-size: 14px; + font-weight: 600; +} + +p, +ul, +ol { + margin-bottom: 10px; + font-weight: normal; +} + +p li, +ul li, +ol li { + margin-left: 5px; + list-style-position: inside; +} + +/* ------------------------------------- + LINKS & BUTTONS +------------------------------------- */ +a { + color: #348eda; + text-decoration: underline; +} + +.btn-primary { + text-decoration: none; + color: #FFF; + background-color: #348eda; + border: solid #348eda; + border-width: 10px 20px; + line-height: 2em; + /* 2em * 14px = 28px, use px to get airier line-height also in Thunderbird, and Yahoo!, Outlook.com, AOL webmail clients */ + /*line-height: 28px;*/ + font-weight: bold; + text-align: center; + cursor: pointer; + display: inline-block; + border-radius: 5px; + text-transform: capitalize; +} + +/* ------------------------------------- + OTHER STYLES THAT MIGHT BE USEFUL +------------------------------------- */ +.last { + margin-bottom: 0; +} + +.first { + margin-top: 0; +} + +.aligncenter { + text-align: center; +} + +.alignright { + text-align: right; +} + +.alignleft { + text-align: left; +} + +.clear { + clear: both; +} + +/* ------------------------------------- + ALERTS + Change the class depending on warning email, good email or bad email +------------------------------------- */ +.alert { + font-size: 16px; + color: #fff; + font-weight: 500; + padding: 20px; + text-align: center; + border-radius: 3px 3px 0 0; +} + +.alert a { + color: #fff; + text-decoration: none; + font-weight: 500; + font-size: 16px; +} + +.alert.alert-warning { + background-color: #FF9F00; +} + +.alert.alert-bad { + background-color: #D0021B; +} + +.alert.alert-good { + background-color: #68B90F; +} + +/* ------------------------------------- + INVOICE + Styles for the billing table +------------------------------------- */ +.invoice { + margin: 40px auto; + text-align: left; + width: 80%; +} + +.invoice td { + padding: 5px 0; +} + +.invoice .invoice-items { + width: 100%; +} + +.invoice .invoice-items td { + border-top: #eee 1px solid; +} + +.invoice .invoice-items .total td { + border-top: 2px solid #333; + border-bottom: 2px solid #333; + font-weight: 700; +} + +/* ------------------------------------- + RESPONSIVE AND MOBILE FRIENDLY STYLES +------------------------------------- */ +@media only screen and (max-width: 640px) { + body { + padding: 0 !important; + } + + h1, + h2, + h3, + h4 { + font-weight: 800 !important; + margin: 20px 0 5px !important; + } + + h1 { + font-size: 22px !important; + } + + h2 { + font-size: 18px !important; + } + + h3 { + font-size: 16px !important; + } + + .container { + padding: 0 !important; + width: 100% !important; + } + + .content { + padding: 0 !important; + } + + .content-wrap { + padding: 10px !important; + } + + .invoice { + width: 100% !important; + } +} + +/*# sourceMappingURL=styles.css.map */ \ No newline at end of file diff --git a/breccia_mapper/static/css/global.css b/breccia_mapper/static/css/global.css index bacc0ee..437e932 100644 --- a/breccia_mapper/static/css/global.css +++ b/breccia_mapper/static/css/global.css @@ -12,6 +12,19 @@ body { flex: 1 0 auto; } +main { + padding-top: 12px; +} + +form { + margin-bottom: 24px; +} + +.social_providers_list > form { + display: inline-block; + margin-bottom: 8px; +} + .footer { height: 60px; diff --git a/breccia_mapper/templates/account/Profile.html b/breccia_mapper/templates/account/Profile.html new file mode 100755 index 0000000..e69de29 diff --git a/breccia_mapper/templates/account/account_inactive.html b/breccia_mapper/templates/account/account_inactive.html new file mode 100755 index 0000000..3347f4f --- /dev/null +++ b/breccia_mapper/templates/account/account_inactive.html @@ -0,0 +1,11 @@ +{% 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/breccia_mapper/templates/account/base.html b/breccia_mapper/templates/account/base.html new file mode 100755 index 0000000..63913c1 --- /dev/null +++ b/breccia_mapper/templates/account/base.html @@ -0,0 +1 @@ +{% extends "base.html" %} \ No newline at end of file diff --git a/breccia_mapper/templates/account/email.html b/breccia_mapper/templates/account/email.html new file mode 100755 index 0000000..8176b31 --- /dev/null +++ b/breccia_mapper/templates/account/email.html @@ -0,0 +1,93 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Account Details" %}{% endblock %} + +{% block content %} + +

Account Details

+ +

{% trans "Email Addresses" %}

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

{% trans 'The following email addresses are associated with your account:' %}

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

{% trans 'Warning:'%} {% trans "You do not have any email addresses set up. Please add an email address to receive notifications, reset your password, and perform other account-related actions." %}

+ +{% endif %} + + +

{% trans "Add Email Address" %}

+ +
+ {% csrf_token %} + {% load bootstrap4 %} + {% bootstrap_form form %} + +
+ +

{% trans "Change Password" %}

+ +{% trans "Change password" %} + +

{% trans "Federated Login" %}

+ +

You can connect third-party accounts to log into this site with them.

+ +{% trans "Manage" %} + + +{% endblock %} + +{% block extra_body %} + +{% endblock %} diff --git a/breccia_mapper/templates/account/email/email_account_creation_message.html b/breccia_mapper/templates/account/email/email_account_creation_message.html new file mode 100644 index 0000000..da02e0c --- /dev/null +++ b/breccia_mapper/templates/account/email/email_account_creation_message.html @@ -0,0 +1,76 @@ +{% load account %} +{% user_display user as user_display %} +{% load i18n %} +{% load inlinecss %} +{% inlinecss "css/emails.css" %} + + + + + + + + Your New {{ settings.PROJECT_LONG_NAME }} Account + + + + + + + + + + +
+
+ + + + +
+ + + + + + + + + + + + + + + + +
+

{{ settings.PROJECT_LONG_NAME }}

+
+ You have a new account on {{ settings.PROJECT_LONG_NAME }}. You can log in with the button below. +
+ Your username is {{ user.username }}. +
+ +
+ The {{ settings.PROJECT_SHORT_NAME }} team +
+
+ +
+
+ + + + + +{% endinlinecss %} \ No newline at end of file diff --git a/breccia_mapper/templates/account/email/email_account_creation_message.txt b/breccia_mapper/templates/account/email/email_account_creation_message.txt new file mode 100644 index 0000000..c9c77d4 --- /dev/null +++ b/breccia_mapper/templates/account/email/email_account_creation_message.txt @@ -0,0 +1,10 @@ +Dear user, + +You have a new account on {{ settings.PROJECT_LONG_NAME }}. You can log in at the link below. + +Your username is {{ user.username }}. + +Log in: {{ settings.SITE_PROTOCOL }}://{{ settings.SITE_URL }}/accounts/login/ + +Thanks, +The {{ settings.PROJECT_SHORT_NAME }} team \ No newline at end of file diff --git a/breccia_mapper/templates/account/email/email_confirmation_message.html b/breccia_mapper/templates/account/email/email_confirmation_message.html new file mode 100755 index 0000000..c248e0f --- /dev/null +++ b/breccia_mapper/templates/account/email/email_confirmation_message.html @@ -0,0 +1,71 @@ +{% load account %} +{% user_display user as user_display %} +{% load i18n %} +{% load inlinecss %} +{% inlinecss "css/emails.css" %} + + + + + + +Registration confirmation email + + + + + + + + + + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + +
+

{{ settings.PROJECT_LONG_NAME }}

+
+ Please confirm your email address by clicking the link below. +
+ We may need to send you critical information about our service, so it is important that we have your correct email address. +
+ +
+ The {{ settings.PROJECT_SHORT_NAME }} team +
+
+
+
+ + + + +{% endinlinecss %} diff --git a/breccia_mapper/templates/account/email/email_confirmation_signup_message.html b/breccia_mapper/templates/account/email/email_confirmation_signup_message.html new file mode 100755 index 0000000..aa4ccd3 --- /dev/null +++ b/breccia_mapper/templates/account/email/email_confirmation_signup_message.html @@ -0,0 +1 @@ +{% include "account/email/email_confirmation_message.html" %} diff --git a/breccia_mapper/templates/account/email/email_confirmation_signup_subject.html b/breccia_mapper/templates/account/email/email_confirmation_signup_subject.html new file mode 100755 index 0000000..dee2d6d --- /dev/null +++ b/breccia_mapper/templates/account/email/email_confirmation_signup_subject.html @@ -0,0 +1,4 @@ +{% load i18n %} +{% autoescape off %} +{% blocktrans %}Confirm Your Registration - {{ settings.PROJECT_SHORT_NAME }}{% endblocktrans %} +{% endautoescape %} diff --git a/breccia_mapper/templates/account/email/email_confirmation_subject.html b/breccia_mapper/templates/account/email/email_confirmation_subject.html new file mode 100755 index 0000000..4c4ce87 --- /dev/null +++ b/breccia_mapper/templates/account/email/email_confirmation_subject.html @@ -0,0 +1 @@ +Confirm Your Email \ No newline at end of file diff --git a/breccia_mapper/templates/account/email/password_reset_key_message.html b/breccia_mapper/templates/account/email/password_reset_key_message.html new file mode 100755 index 0000000..f001892 --- /dev/null +++ b/breccia_mapper/templates/account/email/password_reset_key_message.html @@ -0,0 +1,69 @@ +{% load i18n %} +{% load inlinecss %} +{% inlinecss "css/emails.css" %} + + + + + + +Reset your Password + + + + + + + + + + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + +
+

{{ settings.PROJECT_LONG_NAME }}

+
+ Please reset your password by clicking the link below. +
+ We may need to send you critical information about our service, so it is important that we have your correct email address. +
+ +
+ The {{ settings.PROJECT_SHORT_NAME }} team +
+
+
+
+ + + + +{% endinlinecss %} diff --git a/breccia_mapper/templates/account/email/password_reset_key_subject.html b/breccia_mapper/templates/account/email/password_reset_key_subject.html new file mode 100755 index 0000000..0a9a52c --- /dev/null +++ b/breccia_mapper/templates/account/email/password_reset_key_subject.html @@ -0,0 +1,4 @@ +{% load i18n %} +{% autoescape off %} +{% blocktrans %}Reset Password - {{ settings.PROJECT_SHORT_NAME }}{% endblocktrans %} +{% endautoescape %} diff --git a/breccia_mapper/templates/account/email_confirm.html b/breccia_mapper/templates/account/email_confirm.html new file mode 100755 index 0000000..e3dcd8e --- /dev/null +++ b/breccia_mapper/templates/account/email_confirm.html @@ -0,0 +1,32 @@ +{% extends "account/base.html" %} + +{% load i18n %} +{% load account %} +{% block head_title %}{% trans "Confirm Email Address" %}{% endblock %} + + +{% block content %} + +

{% trans "Confirm Email Address" %}

+ +{% if confirmation %} + +

{% blocktrans with confirmation.email_address.email as email %} Please confirm ownership of {{ email }}.{% endblocktrans %}

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

{% blocktrans %}This email confirmation link expired or is invalid. Please request a new email confirmation. You will be redirected to the login page in 5 seconds.{% endblocktrans %}

+ + +{% endif %} + +{% endblock %} diff --git a/breccia_mapper/templates/account/login.html b/breccia_mapper/templates/account/login.html new file mode 100755 index 0000000..17f97c1 --- /dev/null +++ b/breccia_mapper/templates/account/login.html @@ -0,0 +1,59 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_links %} + +Sign In + +{% endblock %} + +{% block head_title %}{% trans "Sign In" %} {% endblock %} + +{% block content %} + +

{% trans "Sign In" %}

+ +
+ {% csrf_token %} + + {% load bootstrap4 %} + {% bootstrap_form form %} + + {% if redirect_field_value %} + + + + {% endif %} + + + {% trans "Forgot password?" %} + +
+ +{% if config.ENABLE_GOOGLE_LOGIN or config.ENABLE_MICROSOFT_LOGIN %} + +{% load account socialaccount %} + +{% get_providers as socialaccount_providers %} +
Federated Login
+
+ +{% for provider in socialaccount_providers %} +{% if provider.name == "Google" and config.ENABLE_GOOGLE_LOGIN or provider.name == "Microsoft Graph" and config.ENABLE_MICROSOFT_LOGIN %} +
+ {% csrf_token %} + +
+{% endif %} +{% endfor %} +
+ +{% endif %} +{% endblock %} diff --git a/breccia_mapper/templates/account/logout.html b/breccia_mapper/templates/account/logout.html new file mode 100755 index 0000000..634db8d --- /dev/null +++ b/breccia_mapper/templates/account/logout.html @@ -0,0 +1,26 @@ +{% 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 %} + + + {% trans 'No' %} +
+ +{% endblock %} diff --git a/breccia_mapper/templates/account/messages/cannot_delete_primary_email.txt b/breccia_mapper/templates/account/messages/cannot_delete_primary_email.txt new file mode 100755 index 0000000..9c17574 --- /dev/null +++ b/breccia_mapper/templates/account/messages/cannot_delete_primary_email.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}You cannot remove your primary email address ({{email}}).{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/email_confirmation_sent.txt b/breccia_mapper/templates/account/messages/email_confirmation_sent.txt new file mode 100755 index 0000000..fb30b31 --- /dev/null +++ b/breccia_mapper/templates/account/messages/email_confirmation_sent.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Confirmation email sent to {{email}}.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/email_confirmed.txt b/breccia_mapper/templates/account/messages/email_confirmed.txt new file mode 100755 index 0000000..3427a4d --- /dev/null +++ b/breccia_mapper/templates/account/messages/email_confirmed.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}You have confirmed {{email}}.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/email_deleted.txt b/breccia_mapper/templates/account/messages/email_deleted.txt new file mode 100755 index 0000000..27bb630 --- /dev/null +++ b/breccia_mapper/templates/account/messages/email_deleted.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Removed email address {{email}}.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/logged_in.txt b/breccia_mapper/templates/account/messages/logged_in.txt new file mode 100755 index 0000000..7fcfde8 --- /dev/null +++ b/breccia_mapper/templates/account/messages/logged_in.txt @@ -0,0 +1,4 @@ +{% load account %} +{% load i18n %} +{% user_display user as name %} +{% blocktrans %}Successfully logged in as {{name}}.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/logged_out.txt b/breccia_mapper/templates/account/messages/logged_out.txt new file mode 100755 index 0000000..2cd4627 --- /dev/null +++ b/breccia_mapper/templates/account/messages/logged_out.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}You have signed out.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/password_changed.txt b/breccia_mapper/templates/account/messages/password_changed.txt new file mode 100755 index 0000000..bd5801c --- /dev/null +++ b/breccia_mapper/templates/account/messages/password_changed.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Password successfully changed.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/password_set.txt b/breccia_mapper/templates/account/messages/password_set.txt new file mode 100755 index 0000000..9d224ee --- /dev/null +++ b/breccia_mapper/templates/account/messages/password_set.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Password successfully set.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/primary_email_set.txt b/breccia_mapper/templates/account/messages/primary_email_set.txt new file mode 100755 index 0000000..3ef8561 --- /dev/null +++ b/breccia_mapper/templates/account/messages/primary_email_set.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Primary email address set.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/messages/unverified_primary_email.txt b/breccia_mapper/templates/account/messages/unverified_primary_email.txt new file mode 100755 index 0000000..7d0ef9c --- /dev/null +++ b/breccia_mapper/templates/account/messages/unverified_primary_email.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Your primary email address must be verified.{% endblocktrans %} diff --git a/breccia_mapper/templates/account/password_change.html b/breccia_mapper/templates/account/password_change.html new file mode 100755 index 0000000..58e4c13 --- /dev/null +++ b/breccia_mapper/templates/account/password_change.html @@ -0,0 +1,18 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Change Password" %}{% endblock %} + +{% block content %} + +

{% trans "Change Password" %}

+ +
+ {% csrf_token %} + + {% load bootstrap4 %} + {% bootstrap_form form %} + +
+{% endblock %} diff --git a/breccia_mapper/templates/account/password_reset.html b/breccia_mapper/templates/account/password_reset.html new file mode 100755 index 0000000..9357a6a --- /dev/null +++ b/breccia_mapper/templates/account/password_reset.html @@ -0,0 +1,26 @@ +{% extends "account/base.html" %} +{% load i18n %} +{% load account %} + +{% block head_title %}{% trans "Password Reset" %}{% endblock %} + +{% block content %} + +{% if user.is_authenticated %} + {% include "account/snippets/already_logged_in.html" %} +{% endif %} + +

{% trans "Password Reset" %}

+

{% trans "Forgotten your password? Enter your email address below to reset it." %}

+ +
+{% csrf_token %} + +{% load bootstrap4 %} +{% bootstrap_form form %} + +
+ +

{% blocktrans %}Please contact us if you are unable to reset your password.{% endblocktrans %}

+ +{% endblock %} diff --git a/breccia_mapper/templates/account/password_reset_done.html b/breccia_mapper/templates/account/password_reset_done.html new file mode 100755 index 0000000..aac5418 --- /dev/null +++ b/breccia_mapper/templates/account/password_reset_done.html @@ -0,0 +1,20 @@ +{% extends "account/base.html" %} + +{% load i18n %} +{% load account %} + +{% block head_title %}{% trans "Password Reset" %}{% endblock %} + +{% block content %} +

{% trans "Password Reset Email Sent." %}

+ + {% if user.is_authenticated %} + {% include "account/snippets/already_logged_in.html" %} + {% block content_extra %} {% endblock %} + {% else %} +

A password reset link has been sent to your email address. Please contact us if you do not receive it within a few minutes.
You will be redirected to sign in in 5 seconds.

+ + {% endif %} +{% endblock %} diff --git a/breccia_mapper/templates/account/password_reset_from_key.html b/breccia_mapper/templates/account/password_reset_from_key.html new file mode 100755 index 0000000..26b20c5 --- /dev/null +++ b/breccia_mapper/templates/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 %} + {% load bootstrap4 %} + {% bootstrap_form form %} + +
+ {% else %} +

{% trans 'Your password has been changed.' %}

+ {% endif %} + {% endif %} +{% endblock %} diff --git a/breccia_mapper/templates/account/password_reset_from_key_done.html b/breccia_mapper/templates/account/password_reset_from_key_done.html new file mode 100755 index 0000000..4ae5f39 --- /dev/null +++ b/breccia_mapper/templates/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 has been changed.' %}

+{% endblock %} diff --git a/breccia_mapper/templates/account/password_set.html b/breccia_mapper/templates/account/password_set.html new file mode 100755 index 0000000..559b760 --- /dev/null +++ b/breccia_mapper/templates/account/password_set.html @@ -0,0 +1,18 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Set Password" %}{% endblock %} + +{% block content %} + +

{% trans "Set Password" %}

+ +
+ {% csrf_token %} + + {% load bootstrap4 %} + {% bootstrap_form form %} + +
+{% endblock %} diff --git a/breccia_mapper/templates/account/signup.html b/breccia_mapper/templates/account/signup.html new file mode 100755 index 0000000..7881514 --- /dev/null +++ b/breccia_mapper/templates/account/signup.html @@ -0,0 +1,33 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Sign Up" %}{% endblock %} +{% block head_links %} + +Signup + +{% endblock %} + +{% block content %} + +

{% trans "Sign Up" %}

+ +

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

+ +
+ {% csrf_token %} + + {% load bootstrap4 %} + {% bootstrap_form form %} + + {% if redirect_field_value %} + + + + {% endif %} + + +
+ +{% endblock %} diff --git a/breccia_mapper/templates/account/signup_closed.html b/breccia_mapper/templates/account/signup_closed.html new file mode 100755 index 0000000..62c0eff --- /dev/null +++ b/breccia_mapper/templates/account/signup_closed.html @@ -0,0 +1,11 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} + +{% block content %} +

{% trans "Sign Up Closed" %}

+ +

{% blocktrans with project_long_name=settings.PROJECT_LONG_NAME %}Signing up to {{ project_long_name }} is currently not permitted.{% endblocktrans %}

+{% endblock %} diff --git a/breccia_mapper/templates/account/snippets/already_logged_in.html b/breccia_mapper/templates/account/snippets/already_logged_in.html new file mode 100755 index 0000000..12f9e73 --- /dev/null +++ b/breccia_mapper/templates/account/snippets/already_logged_in.html @@ -0,0 +1,11 @@ +{% load i18n %} +{% load account %} + +{% block content %} +{% user_display user as user_display %} + +

Already Logged In

+

You are already logged in as {{ user_display }}.

+Account Details + +{% endblock %} \ No newline at end of file diff --git a/breccia_mapper/templates/account/verification_sent.html b/breccia_mapper/templates/account/verification_sent.html new file mode 100755 index 0000000..8ac95be --- /dev/null +++ b/breccia_mapper/templates/account/verification_sent.html @@ -0,0 +1,12 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Verify Your Email Address" %}{% endblock %} + +{% block content %} +

{% trans "Verify Your Email Address" %}

+ +

{% blocktrans %}A verification email has been sent to your email address. Follow the link provided to activate your account. Contact us if you do not receive it within a few minutes.{% endblocktrans %}

+ +{% endblock %} diff --git a/breccia_mapper/templates/account/verified_email_required.html b/breccia_mapper/templates/account/verified_email_required.html new file mode 100755 index 0000000..25447f1 --- /dev/null +++ b/breccia_mapper/templates/account/verified_email_required.html @@ -0,0 +1,22 @@ +{% extends "account/base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Verify Your Email Address" %}{% endblock %} + +{% block content %} +

{% trans "Verify Your Email 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. We therefore require you to +verify ownership of your email address. {% endblocktrans %}

+ +

{% blocktrans %}A verification email has been sent to your email address. Follow the link provided to activate your account. Contact us +if you do not receive it within a few minutes.{% endblocktrans %}

+ +

{% blocktrans %}Note: you can still change your email address.{% endblocktrans %}

+ + +{% endblock %} diff --git a/breccia_mapper/templates/base.html b/breccia_mapper/templates/base.html index 0f59ecd..f4dfe76 100755 --- a/breccia_mapper/templates/base.html +++ b/breccia_mapper/templates/base.html @@ -7,6 +7,7 @@ {% load pwa %} +{% load socialaccount %} @@ -76,6 +77,12 @@