diff --git a/README.rst b/README.rst index 0b5ed230..876815b3 100644 --- a/README.rst +++ b/README.rst @@ -50,6 +50,9 @@ To get a basic implementation up and running locally: - Create ``$scram_home/.envs/.production/.postgres`` a template exists in the docs/templates directory - Make sure to set the right credentials - By default this template assumes you have a service defined in docker compose file called postgres. If you use another postgres server, make sure to update that setting as well +- Create a ``.env`` file with the necessary environment variables: + - [comment]: # This chooses if you want to use oidc or local accounts. This can be local or oidc only. Default: `local` + - scram_auth_method: "local" - ``make build`` - ``make toggle-prod`` - This will turn off debug mode in django and start using nginx to reverse proxy for the app diff --git a/config/settings/base.py b/config/settings/base.py index b9e1ca01..766d785e 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -1,6 +1,8 @@ """ Base settings to build other settings files upon. """ + +import logging import os from pathlib import Path @@ -97,12 +99,6 @@ ] # https://docs.djangoproject.com/en/dev/ref/settings/#auth-user-model AUTH_USER_MODEL = "users.User" -# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url -LOGIN_REDIRECT_URL = "route_manager:home" -# https://docs.djangoproject.com/en/dev/ref/settings/#login-url -LOGIN_URL = "admin:login" -# https://docs.djangoproject.com/en/dev/ref/settings/#logout-url -LOGOUT_URL = "admin:logout" # PASSWORDS # ------------------------------------------------------------------------------ @@ -281,6 +277,62 @@ CORS_URLS_REGEX = r"^/api/.*$" # Your stuff... # ------------------------------------------------------------------------------ +# Are you using local passwords or oidc? +AUTH_METHOD = os.environ.get("SCRAM_AUTH_METHOD", "local").lower() + +# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url +LOGIN_REDIRECT_URL = "route_manager:home" + +# Need to point somewhere otherwise /oidc/logout/ redirects to /oidc/logout/None which 404s +# https://github.com/mozilla/mozilla-django-oidc/issues/118 +# Using `/` because named urls don't work for this package +# https://github.com/mozilla/mozilla-django-oidc/issues/434 +LOGOUT_REDIRECT_URL = "route_manager:home" + +OIDC_OP_JWKS_ENDPOINT = os.environ.get( + "OIDC_OP_JWKS_ENDPOINT", + "https://example.com/auth/realms/example/protocol/openid-connect/certs", +) +OIDC_OP_AUTHORIZATION_ENDPOINT = os.environ.get( + "OIDC_OP_AUTHORIZATION_ENDPOINT", + "https://example.com/auth/realms/example/protocol/openid-connect/auth", +) +OIDC_OP_TOKEN_ENDPOINT = os.environ.get( + "OIDC_OP_TOKEN_ENDPOINT", + "https://example.com/auth/realms/example/protocol/openid-connect/token", +) +OIDC_OP_USER_ENDPOINT = os.environ.get( + "OIDC_OP_USER_ENDPOINT", + "https://example.com/auth/realms/example/protocol/openid-connect/userinfo", +) +OIDC_RP_SIGN_ALGO = "RS256" + +logging.info(f"Using AUTH METHOD = {AUTH_METHOD}") +if AUTH_METHOD == "oidc": + # Extend middleware to add OIDC middleware + MIDDLEWARE += ["mozilla_django_oidc.middleware.SessionRefresh"] # noqa F405 + + # Extend middleware to add OIDC auth backend + AUTHENTICATION_BACKENDS += ["scram.route_manager.authentication_backends.ESnetAuthBackend"] # noqa F405 + + # https://docs.djangoproject.com/en/dev/ref/settings/#login-url + LOGIN_URL = "oidc_authentication_init" + + # https://docs.djangoproject.com/en/dev/ref/settings/#logout-url + LOGOUT_URL = "oidc_logout" + + OIDC_RP_CLIENT_ID = os.environ.get("OIDC_RP_CLIENT_ID") + OIDC_RP_CLIENT_SECRET = os.environ.get("OIDC_RP_CLIENT_SECRET") + +elif AUTH_METHOD == "local": + # https://docs.djangoproject.com/en/dev/ref/settings/#login-url + LOGIN_URL = "local_auth:login" + + # https://docs.djangoproject.com/en/dev/ref/settings/#logout-url + LOGOUT_URL = "local_auth:logout" +else: + raise ValueError(f"Invalid authentication method: {AUTH_METHOD}. Please choose 'local' or 'oidc'") + # Should we create an admin user for you AUTOCREATE_ADMIN = True @@ -293,9 +345,6 @@ SIMPLE_HISTORY_HISTORY_CHANGE_REASON_USE_TEXT_FIELD = True SIMPLE_HISTORY_ENABLED = True -# Are you using local passwords or oidc? -AUTH_METHOD = os.environ.get("SCRAM_AUTH_METHOD", "local") - # Users in these groups have full privileges, including Django is_superuser SCRAM_ADMIN_GROUPS = ["svc_scram_admin"] @@ -311,8 +360,6 @@ # This is the set of all the groups SCRAM_GROUPS = SCRAM_ADMIN_GROUPS + SCRAM_READWRITE_GROUPS + SCRAM_READONLY_GROUPS + SCRAM_DENIED_GROUPS -# This is the full set of groups - # How many entries to show PER Actiontype on the home page RECENT_LIMIT = 10 # What is the largest cidr range we'll accept entries for diff --git a/config/settings/local.py b/config/settings/local.py index aaf58204..83b31dd8 100644 --- a/config/settings/local.py +++ b/config/settings/local.py @@ -1,5 +1,5 @@ from .base import * # noqa -from .base import env +from .base import AUTH_METHOD, env # GENERAL # ------------------------------------------------------------------------------ @@ -71,3 +71,14 @@ # Behave Django testing framework INSTALLED_APPS += ["behave_django"] # noqa F405 + +# AUTHENTICATION +# ------------------------------------------------------------------------------ +# We shouldn't be using OIDC in local dev mode as of now, but might be worth pursuing later +if AUTH_METHOD == "oidc": + raise NotImplementedError("oidc is not yet implemented") + +# https://docs.djangoproject.com/en/dev/ref/settings/#login-url +LOGIN_URL = "admin:login" +# https://docs.djangoproject.com/en/dev/ref/settings/#logout-url +LOGOUT_URL = "admin:logout" diff --git a/config/settings/production.py b/config/settings/production.py index 6d4484cc..8f62b5d4 100644 --- a/config/settings/production.py +++ b/config/settings/production.py @@ -1,7 +1,5 @@ -import os - from .base import * # noqa -from .base import AUTHENTICATION_BACKENDS, MIDDLEWARE, env +from .base import env # GENERAL # ------------------------------------------------------------------------------ @@ -141,44 +139,3 @@ # Your stuff... # ------------------------------------------------------------------------------ -# Extend middleware to add OIDC middleware -MIDDLEWARE += ["mozilla_django_oidc.middleware.SessionRefresh"] # noqa F405 - -# Extend middleware to add OIDC auth backend -AUTHENTICATION_BACKENDS += ["scram.route_manager.authentication_backends.ESnetAuthBackend"] # noqa F405 - -# https://docs.djangoproject.com/en/dev/ref/settings/#login-url -LOGIN_URL = "oidc_authentication_init" - -# https://docs.djangoproject.com/en/dev/ref/settings/#login-redirect-url -LOGIN_REDIRECT_URL = "/" - -# https://docs.djangoproject.com/en/dev/ref/settings/#logout-url -LOGOUT_URL = "oidc_logout" - -# Need to point somewhere otherwise /oidc/logout/ redirects to /oidc/logout/None which 404s -# https://github.com/mozilla/mozilla-django-oidc/issues/118 -# Using `/` because named urls don't work for this package -# https://github.com/mozilla/mozilla-django-oidc/issues/434 -LOGOUT_REDIRECT_URL = "/" - -OIDC_OP_JWKS_ENDPOINT = os.environ.get( - "OIDC_OP_JWKS_ENDPOINT", - "https://example.com/auth/realms/example/protocol/openid-connect/certs", -) -OIDC_OP_AUTHORIZATION_ENDPOINT = os.environ.get( - "OIDC_OP_AUTHORIZATION_ENDPOINT", - "https://example.com/auth/realms/example/protocol/openid-connect/auth", -) -OIDC_OP_TOKEN_ENDPOINT = os.environ.get( - "OIDC_OP_TOKEN_ENDPOINT", - "https://example.com/auth/realms/example/protocol/openid-connect/token", -) -OIDC_OP_USER_ENDPOINT = os.environ.get( - "OIDC_OP_USER_ENDPOINT", - "https://example.com/auth/realms/example/protocol/openid-connect/userinfo", -) -OIDC_RP_SIGN_ALGO = "RS256" - -OIDC_RP_CLIENT_ID = os.environ.get("OIDC_RP_CLIENT_ID") -OIDC_RP_CLIENT_SECRET = os.environ.get("OIDC_RP_CLIENT_SECRET") diff --git a/config/settings/test.py b/config/settings/test.py index 1eb5ed4a..a4951b2c 100644 --- a/config/settings/test.py +++ b/config/settings/test.py @@ -2,8 +2,6 @@ With these settings, tests run faster. """ -import os - from .base import * # noqa from .base import env @@ -41,26 +39,11 @@ # Your stuff... # ------------------------------------------------------------------------------ -# Extend middleware to add OIDC middleware -MIDDLEWARE += ["mozilla_django_oidc.middleware.SessionRefresh"] # noqa F405 - -OIDC_OP_JWKS_ENDPOINT = os.environ.get( - "OIDC_OP_JWKS_ENDPOINT", - "https://example.com/auth/realms/example/protocol/openid-connect/certs", -) -OIDC_OP_AUTHORIZATION_ENDPOINT = os.environ.get( - "OIDC_OP_AUTHORIZATION_ENDPOINT", - "https://example.com/auth/realms/example/protocol/openid-connect/auth", -) -OIDC_OP_TOKEN_ENDPOINT = os.environ.get( - "OIDC_OP_TOKEN_ENDPOINT", - "https://example.com/auth/realms/example/protocol/openid-connect/token", -) -OIDC_OP_USER_ENDPOINT = os.environ.get( - "OIDC_OP_USER_ENDPOINT", - "https://example.com/auth/realms/example/protocol/openid-connect/userinfo", -) +# These variables are required by the ESnetAuthBackend called in our OidcTest case +OIDC_OP_JWKS_ENDPOINT = "https://example.com/auth/realms/example/protocol/openid-connect/certs" +OIDC_OP_AUTHORIZATION_ENDPOINT = "https://example.com/auth/realms/example/protocol/openid-connect/auth" +OIDC_OP_TOKEN_ENDPOINT = "https://example.com/auth/realms/example/protocol/openid-connect/token" +OIDC_OP_USER_ENDPOINT = "https://example.com/auth/realms/example/protocol/openid-connect/userinfo" OIDC_RP_SIGN_ALGO = "RS256" - -OIDC_RP_CLIENT_ID = os.environ.get("OIDC_RP_CLIENT_ID", "client_id") -OIDC_RP_CLIENT_SECRET = os.environ.get("OIDC_RP_CLIENT_SECRET", "client_secret") +OIDC_RP_CLIENT_ID = "" +OIDC_RP_CLIENT_SECRET = "" diff --git a/config/urls.py b/config/urls.py index a52cd002..ec9e5b7b 100644 --- a/config/urls.py +++ b/config/urls.py @@ -28,7 +28,8 @@ import mozilla_django_oidc # noqa: F401 urlpatterns += [path("oidc/", include("mozilla_django_oidc.urls"))] - +elif settings.AUTH_METHOD == "local": + urlpatterns += [path("auth/", include("scram.local_auth.urls", namespace="local_auth"))] # API URLS api_version_urls = ( [ diff --git a/docs/environment_variables.md b/docs/environment_variables.md new file mode 100644 index 00000000..c44629a7 --- /dev/null +++ b/docs/environment_variables.md @@ -0,0 +1,76 @@ +## Environment Variables to Set for Deployment +[comment]: # Which branch of SCRAM to use (you probably want to set it to a release tag) +scram_code_branch: +#### Systems +[comment]: # Email of the main admin +scram_manager_email: +[comment]: # Set to true for production mode; set to false to set up the compose.override.local.yml stack +scram_prod: true +[comment]: # Set to true if you want ansible to install a scram user +scram_install_user: true +[comment]: # What group to put `scram` user in +scram_group: 'scram' +[comment]: # What username to use for `scram` user +scram_user: '' +[comment]: # WHat uid to use for `scram` user +scram_uid: '' +[comment]: # What directory to use for base of the repo +scram_home: '/usr/local/scram' +[comment]: # IP or DNS record for your postgres host +scram_postgres_host: +[comment]: # What postgres user to use +scram_postgres_user: '' + +#### Authentication +[comment]: # This chooses if you want to use oidc or local accounts. This can be local or oidc only. Default: `local` +scram_auth_method: "local" +[comment]: # This client id (username) for your oidc connection. Only need to set this if you are trying to do oidc. +scram_oidc_client_id: + +#### Networking +[comment]: # What is the peering interface docker uses for gobgp to talk to the router +scram_peering_iface: 'ens192' +[comment]: # The v6 network of your peering connection +scram_v4_subnet: '10.0.0.0/24' +[comment]: # The v4 IP of the peering connection for the router side +scram_v4_gateway: '10.0.0.1' +[comment]: # The v4 IP of the peering connection for gobgp side +scram_v4_address: '10.0.0.2' +[comment]: # The v6 network of your peering connection +scram_v6_subnet: '2001:db8::/64' +[comment]: # The v6 IP of the peering connection for the router side +scram_v6_gateway: '2001:db8::2' +[comment]: # The v6 IP of the peering connection for the gobgp side +scram_v6_address: '2001:db8::3' +[comment]: # The AS you want to use for gobgp +scram_as: +[comment]: # A string representing your gobgp instance. Often seen as the local IP of the gobgp instance +scram_router_id: +[comment]: # +scram_peer_as: +[comment]: # The AS you want to use for gobgp side (can this be the same as `scram_as`?) +scram_local_as: +[comment]: # The fqdn of the server hosting this - to be used for nginx +scram_nginx_host: +[comment]: # List of allowed hosts per the django setting "ALLOWED_HOSTS". This should be a list of strings in shell +[comment]: # `django` is required for the websockets to work +[comment]: # Our Ansible assumes `django` + `scram_nginx_host` +scram_django_allowed_hosts: "django" +[comment]: # The fqdn of the server hosting this - to be used for nginx +scram_server_alias: +[comment]: # Do you want to set an md5 for authentication of bgp +scram_bgp_md5_enabled: false +[comment]: # The neighbor config of your gobgp config +scram_neighbors: +[comment]: # The v6 address of your neighbor + - neighbor_address: 2001:db8::2 +[comment]: # This is a v6 address so don't use v4 + ipv4: false +[comment]: # This is a v6 address so use v6 + ipv6: true +[comment]: # The v4 address of your neighbor + - neighbor_address: 10.0.0.200 +[comment]: # This is a v4 address so use v4 + ipv4: true +[comment]: # This is a v4 address so don't use v6 + ipv6: false diff --git a/requirements/local.txt b/requirements/local.txt index c2e5317c..2a6c95ae 100644 --- a/requirements/local.txt +++ b/requirements/local.txt @@ -8,7 +8,7 @@ watchgod==0.8.2 # https://github.com/samuelcolvin/watchgod # Testing # ------------------------------------------------------------------------------ django-stubs==1.11.0 # https://github.com/typeddjango/django-stubs -pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar +pytest-sugar==0.9.6 # https://github.com/Frozenball/pytest-sugar behave-django==1.4.0 # https://github.com/behave/behave-django # Documentation diff --git a/scram/local_auth/__init__.py b/scram/local_auth/__init__.py new file mode 100644 index 00000000..113a7bfa --- /dev/null +++ b/scram/local_auth/__init__.py @@ -0,0 +1 @@ +"""Local_auth is the app that holds urls we want to use with local Django auth.""" diff --git a/scram/local_auth/urls.py b/scram/local_auth/urls.py new file mode 100644 index 00000000..56c7b727 --- /dev/null +++ b/scram/local_auth/urls.py @@ -0,0 +1,15 @@ +"""Register URLs for local auth known to Django, and the View that will handle each.""" + +from django.contrib.auth.views import LoginView, LogoutView +from django.urls import path + +app_name = "local_auth" + +urlpatterns = [ + path( + "login/", + LoginView.as_view(template_name="local_auth/login.html", success_url="route_manager:home"), + name="login", + ), + path("logout/", LogoutView.as_view(), name="logout"), +] diff --git a/scram/route_manager/tests/test_authorization.py b/scram/route_manager/tests/test_authorization.py index 54f372b0..17de2b6d 100644 --- a/scram/route_manager/tests/test_authorization.py +++ b/scram/route_manager/tests/test_authorization.py @@ -132,8 +132,8 @@ def test_unauthorized_after_group_removal(self): self.assertEqual(response.status_code, 302) -class OidcTest(TestCase): - """Define tests using OIDC authentication.""" +class ESnetAuthBackendTest(TestCase): + """Define tests using OIDC authentication with our ESnetAuthBackend.""" def setUp(self): """Create a sample OIDC user.""" diff --git a/scram/route_manager/tests/test_autocreate_admin.py b/scram/route_manager/tests/test_autocreate_admin.py new file mode 100644 index 00000000..b9d2e432 --- /dev/null +++ b/scram/route_manager/tests/test_autocreate_admin.py @@ -0,0 +1,48 @@ +"""This file contains tests for the auto-creation of an admin user.""" + +import pytest +from django.contrib.auth.models import User +from django.contrib.messages import get_messages +from django.test import Client +from django.urls import reverse + +from scram.users.models import User + + +@pytest.mark.django_db +def test_autocreate_admin(settings): + """Test that an admin user is auto-created when AUTOCREATE_ADMIN is True.""" + settings.AUTOCREATE_ADMIN = True + client = Client() + response = client.get(reverse("route_manager:home")) + assert response.status_code == 200 + assert User.objects.count() == 1 + user = User.objects.get(username="admin") + assert user.is_superuser + assert user.email == "admin@example.com" + messages = list(get_messages(response.wsgi_request)) + assert len(messages) == 2 + assert messages[0].level == 25 # SUCCESS + assert messages[1].level == 20 # INFO + + +@pytest.mark.django_db +def test_autocreate_admin_disabled(settings): + """Test that an admin user is not auto-created when AUTOCREATE_ADMIN is False.""" + settings.AUTOCREATE_ADMIN = False + client = Client() + response = client.get(reverse("route_manager:home")) + assert response.status_code == 200 + assert User.objects.count() == 0 + + +@pytest.mark.django_db +def test_autocreate_admin_existing_user(settings): + """Test that an admin user is not auto-created when an existing user is present.""" + settings.AUTOCREATE_ADMIN = True + User.objects.create_user("testuser", "test@example.com", "password") + client = Client() + response = client.get(reverse("route_manager:home")) + assert response.status_code == 200 + assert User.objects.count() == 1 + assert not User.objects.filter(username="admin").exists() diff --git a/scram/templates/account/account_inactive.html b/scram/templates/account/account_inactive.html deleted file mode 100644 index 17c21577..00000000 --- a/scram/templates/account/account_inactive.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} - -{% block head_title %}{% trans "Account Inactive" %}{% endblock %} - -{% block inner %} -

{% trans "Account Inactive" %}

- -

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

-{% endblock %} - diff --git a/scram/templates/account/base.html b/scram/templates/account/base.html deleted file mode 100644 index 97f4ddb8..00000000 --- a/scram/templates/account/base.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "../base.html" %} -{% block title %}{% block head_title %}{% endblock head_title %}{% endblock title %} - -{% block content %} -
-
- {% block inner %}{% endblock %} -
-
-{% endblock %} diff --git a/scram/templates/account/email.html b/scram/templates/account/email.html deleted file mode 100644 index 8eef4159..00000000 --- a/scram/templates/account/email.html +++ /dev/null @@ -1,80 +0,0 @@ - -{% extends "account/base.html" %} - -{% load i18n %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Account" %}{% endblock %} - -{% block inner %} -

{% 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|crispy }} - -
- -{% endblock %} - - -{% block inline_javascript %} -{{ block.super }} - -{% endblock %} - diff --git a/scram/templates/account/email_confirm.html b/scram/templates/account/email_confirm.html deleted file mode 100644 index 46c78126..00000000 --- a/scram/templates/account/email_confirm.html +++ /dev/null @@ -1,32 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load account %} - -{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %} - - -{% block inner %} -

{% 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/scram/templates/account/login.html b/scram/templates/account/login.html deleted file mode 100644 index 2cadea6a..00000000 --- a/scram/templates/account/login.html +++ /dev/null @@ -1,48 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load account socialaccount %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Sign In" %}{% endblock %} - -{% block inner %} - -

{% 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 %}

- -
- - - -
{% trans 'or' %}
- -
- -{% 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|crispy }} - {% if redirect_field_value %} - - {% endif %} - {% trans "Forgot Password?" %} - -
- -{% endblock %} - diff --git a/scram/templates/account/logout.html b/scram/templates/account/logout.html deleted file mode 100644 index 8e2e6754..00000000 --- a/scram/templates/account/logout.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} - -{% block head_title %}{% trans "Sign Out" %}{% endblock %} - -{% block inner %} -

{% trans "Sign Out" %}

- -

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

- -
- {% csrf_token %} - {% if redirect_field_value %} - - {% endif %} - -
- - -{% endblock %} - diff --git a/scram/templates/account/password_change.html b/scram/templates/account/password_change.html deleted file mode 100644 index b72ca068..00000000 --- a/scram/templates/account/password_change.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Change Password" %}{% endblock %} - -{% block inner %} -

{% trans "Change Password" %}

- -
- {% csrf_token %} - {{ form|crispy }} - -
-{% endblock %} - diff --git a/scram/templates/account/password_reset.html b/scram/templates/account/password_reset.html deleted file mode 100644 index c98f28c1..00000000 --- a/scram/templates/account/password_reset.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load account %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Password Reset" %}{% endblock %} - -{% block inner %} - -

{% trans "Password Reset" %}

- {% if user.is_authenticated %} - {% include "/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|crispy }} - -
- -

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

-{% endblock %} diff --git a/scram/templates/account/password_reset_done.html b/scram/templates/account/password_reset_done.html deleted file mode 100644 index 835156ca..00000000 --- a/scram/templates/account/password_reset_done.html +++ /dev/null @@ -1,16 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load account %} - -{% block head_title %}{% trans "Password Reset" %}{% endblock %} - -{% block inner %} -

{% trans "Password Reset" %}

- - {% if user.is_authenticated %} - {% include "/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/scram/templates/account/password_reset_from_key.html b/scram/templates/account/password_reset_from_key.html deleted file mode 100644 index 2e2cd194..00000000 --- a/scram/templates/account/password_reset_from_key.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load crispy_forms_tags %} -{% block head_title %}{% trans "Change Password" %}{% endblock %} - -{% block inner %} -

{% 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|crispy }} - -
- {% else %} -

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

- {% endif %} - {% endif %} -{% endblock %} diff --git a/scram/templates/account/password_reset_from_key_done.html b/scram/templates/account/password_reset_from_key_done.html deleted file mode 100644 index 89be086f..00000000 --- a/scram/templates/account/password_reset_from_key_done.html +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% block head_title %}{% trans "Change Password" %}{% endblock %} - -{% block inner %} -

{% trans "Change Password" %}

-

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

-{% endblock %} - diff --git a/scram/templates/account/password_set.html b/scram/templates/account/password_set.html deleted file mode 100644 index 22322235..00000000 --- a/scram/templates/account/password_set.html +++ /dev/null @@ -1,17 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Set Password" %}{% endblock %} - -{% block inner %} -

{% trans "Set Password" %}

- -
- {% csrf_token %} - {{ form|crispy }} - -
-{% endblock %} - diff --git a/scram/templates/account/signup.html b/scram/templates/account/signup.html deleted file mode 100644 index 6a2954eb..00000000 --- a/scram/templates/account/signup.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} -{% load crispy_forms_tags %} - -{% block head_title %}{% trans "Signup" %}{% endblock %} - -{% block inner %} -

{% trans "Sign Up" %}

- -

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

- -
- {% csrf_token %} - {{ form|crispy }} - {% if redirect_field_value %} - - {% endif %} - -
- -{% endblock %} - diff --git a/scram/templates/account/signup_closed.html b/scram/templates/account/signup_closed.html deleted file mode 100644 index 2322f176..00000000 --- a/scram/templates/account/signup_closed.html +++ /dev/null @@ -1,12 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} - -{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} - -{% block inner %} -

{% trans "Sign Up Closed" %}

- -

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

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

{% 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/scram/templates/account/verified_email_required.html b/scram/templates/account/verified_email_required.html deleted file mode 100644 index 09d4fde7..00000000 --- a/scram/templates/account/verified_email_required.html +++ /dev/null @@ -1,24 +0,0 @@ -{% extends "account/base.html" %} - -{% load i18n %} - -{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} - -{% block inner %} -

{% 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/scram/templates/local_auth/login.html b/scram/templates/local_auth/login.html new file mode 100644 index 00000000..e2355d27 --- /dev/null +++ b/scram/templates/local_auth/login.html @@ -0,0 +1,12 @@ +{% extends 'base.html' %} + +{% block title %}Login{% endblock %} + +{% block content %} +

Login

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