Repository: LibraryOfCongress/concordia

Issue:
Template not found when account activation fails
**What behavior did you observe? Please describe the bug**
The log file contains error messages looking for an activation failure template that does not exist.

**How can we reproduce the bug?**
Steps to reproduce the behavior:
1. Register for an account
2. Wait past the amount of time when the activation link is valid.
3. Click the activation link.
4. Check the log file.

**What is the expected behavior?**
If an error occurs when activating someone's account, display a helpful specific error message.

Log excerpt:
```
19:29:00
[2018-10-28T19:29:00 ERROR django.request:118] Internal Server Error: /account/activate/ImVqZ2lsbHki:1gGpOB:B57BALOPAaJAQT7h0t1d4uZNIkA/
19:29:00
Traceback (most recent call last):
19:29:00
File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py", line 35, in inner
19:29:00
response = get_response(request)
19:29:00
File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 158, in _get_response
19:29:00
response = self.process_exception_by_middleware(e, request)
19:29:00
File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 156, in _get_response
19:29:00
response = response.render()
19:29:00
File "/usr/local/lib/python3.6/dist-packages/django/template/response.py", line 106, in render
19:29:00
self.content = self.rendered_content
19:29:00
File "/usr/local/lib/python3.6/dist-packages/django/template/response.py", line 81, in rendered_content
19:29:00
template = self.resolve_template(self.template_name)
19:29:00
File "/usr/local/lib/python3.6/dist-packages/django/template/response.py", line 63, in resolve_template
19:29:00
return select_template(template, using=self.using)
19:29:00
File "/usr/local/lib/python3.6/dist-packages/django/template/loader.py", line 47, in select_template
19:29:00
raise TemplateDoesNotExist(', '.join(template_name_list), chain=chain)
19:29:00
django.template.exceptions.TemplateDoesNotExist: django_registration/activation_failed.html
```



Discussion:
We should add that template and see whether any other steps on https://django-registration.readthedocs.io/en/3.0/quickstart.html were skipped. Based on https://github.com/ubernostrum/django-registration/blob/6617463731aa15a941bde9cef9fc235563c5c3d1/src/django_registration/backends/activation/urls.py#L34 I think https://github.com/LibraryOfCongress/concordia/blob/master/concordia/templates/registration/registration_closed.html might be in the wrong directory, too.
Based on the convo in slack, we should also increase the activate time to 48 hours
Looks like we can remove three redundant settings since the only time it's set to a value other than one day is overridden before it's used:

```
concordia/settings_template.py
215:ACCOUNT_ACTIVATION_DAYS = 7
249:ACCOUNT_ACTIVATION_DAYS = 1

concordia/settings_dev.py
48:ACCOUNT_ACTIVATION_DAYS = 1  # required for HMAC registration two-step-flow

concordia/settings_prod.py
85:ACCOUNT_ACTIVATION_DAYS = 1  # required for HMAC registration two-step-flow
```
I think we've just heard from a volunteer with a related issue: It sounds from their description as though the 24 hour verification hasn't passed, so maybe there's another problem: 

"Hello, I just created an account and received an email telling me to click on a link to complete my account activation. Unfortunately, the link appears to be broken. It says "HTTP 500 Error The server encountered an unexpected condition which prevented it from fulfilling the request. Our staff have been notified about the failure."
Does the password reset work? If not this might be worth a quick update
This is the same missing template. If @rstorey wants I'll take a quick break from CSS to toss it together.

Thanks - I'm stuck in rate limit world at the moment.

Resolving patch:
diff --git a/concordia/settings_dev.py b/concordia/settings_dev.py
--- a/concordia/settings_dev.py
+++ b/concordia/settings_dev.py
@@ -45,8 +45,6 @@
 
 REGISTRATION_SALT = "django_registration"  # doesn't need to be secret
 
-ACCOUNT_ACTIVATION_DAYS = 1  # required for HMAC registration two-step-flow
-
 INSTALLED_APPS += ["debug_toolbar"]
 MIDDLEWARE += ["debug_toolbar.middleware.DebugToolbarMiddleware"]
 INTERNAL_IPS = ("127.0.0.1",)
diff --git a/concordia/settings_prod.py b/concordia/settings_prod.py
--- a/concordia/settings_prod.py
+++ b/concordia/settings_prod.py
@@ -82,6 +82,4 @@
 
 REGISTRATION_SALT = "django_registration"  # doesn't need to be secret
 
-ACCOUNT_ACTIVATION_DAYS = 1  # required for HMAC registration two-step-flow
-
 SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
diff --git a/concordia/settings_template.py b/concordia/settings_template.py
--- a/concordia/settings_template.py
+++ b/concordia/settings_template.py
@@ -212,8 +212,6 @@
 # Django-specific settings above
 ################################################################################
 
-ACCOUNT_ACTIVATION_DAYS = 7
-
 MEDIA_URL = "/media/"
 MEDIA_ROOT = os.path.join(SITE_ROOT_DIR, "media")
 
@@ -245,8 +243,8 @@
 STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
 WHITENOISE_ROOT = os.path.join(SITE_ROOT_DIR, "static")
 
-PASSWORD_RESET_TIMEOUT_DAYS = 1
-ACCOUNT_ACTIVATION_DAYS = 1
+PASSWORD_RESET_TIMEOUT_DAYS = 2
+ACCOUNT_ACTIVATION_DAYS = 2
 REGISTRATION_OPEN = True  # set to false to temporarily disable registrations
 
 MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"


Test patch: