From 84f855c2ffd04319458bbc814fd8bace6fdeebaf Mon Sep 17 00:00:00 2001 From: Arne Schauf Date: Sat, 28 Sep 2013 12:43:57 +0200 Subject: [PATCH] registration things --- nsupdate/nsupdate/settings.py | 4 +++ nsupdate/nsupdate/static/css/nsupdate.css | 2 +- .../templates/registration/activate.html | 14 +++++++++ .../registration/activation_complete.html | 11 +++++++ .../registration/activation_email.html | 26 ++++++++++++++++ .../registration/activation_email.txt | 15 ++++++++++ .../registration/activation_email_subject.txt | 1 + .../templates/registration/login.html | 30 +++++++++++++++++++ .../templates/registration/logout.html | 6 ++++ .../registration/password_change_done.html | 7 +++++ .../registration/password_change_form.html | 11 +++++++ .../registration/password_reset_complete.html | 6 ++++ .../registration/password_reset_confirm.html | 12 ++++++++ .../registration/password_reset_done.html | 9 ++++++ .../registration/password_reset_email.html | 17 +++++++++++ .../registration/password_reset_form.html | 13 ++++++++ .../registration/registration_base.html | 2 ++ .../registration/registration_complete.html | 8 +++++ .../registration/registration_form.html | 11 +++++++ nsupdate/nsupdate/urls.py | 1 + requirements.d/all.txt | 2 ++ 21 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 nsupdate/nsupdate/templates/registration/activate.html create mode 100644 nsupdate/nsupdate/templates/registration/activation_complete.html create mode 100644 nsupdate/nsupdate/templates/registration/activation_email.html create mode 100644 nsupdate/nsupdate/templates/registration/activation_email.txt create mode 100644 nsupdate/nsupdate/templates/registration/activation_email_subject.txt create mode 100644 nsupdate/nsupdate/templates/registration/login.html create mode 100644 nsupdate/nsupdate/templates/registration/logout.html create mode 100644 nsupdate/nsupdate/templates/registration/password_change_done.html create mode 100644 nsupdate/nsupdate/templates/registration/password_change_form.html create mode 100644 nsupdate/nsupdate/templates/registration/password_reset_complete.html create mode 100644 nsupdate/nsupdate/templates/registration/password_reset_confirm.html create mode 100644 nsupdate/nsupdate/templates/registration/password_reset_done.html create mode 100644 nsupdate/nsupdate/templates/registration/password_reset_email.html create mode 100644 nsupdate/nsupdate/templates/registration/password_reset_form.html create mode 100644 nsupdate/nsupdate/templates/registration/registration_base.html create mode 100644 nsupdate/nsupdate/templates/registration/registration_complete.html create mode 100644 nsupdate/nsupdate/templates/registration/registration_form.html diff --git a/nsupdate/nsupdate/settings.py b/nsupdate/nsupdate/settings.py index 190604e..5075075 100644 --- a/nsupdate/nsupdate/settings.py +++ b/nsupdate/nsupdate/settings.py @@ -124,6 +124,8 @@ INSTALLED_APPS = ( 'south', 'nsupdate', 'main', + 'bootstrapform', + 'registration', ) # A sample logging configuration. The only tangible logging @@ -154,3 +156,5 @@ LOGGING = { }, } } + +ACCOUNT_ACTIVATION_DAYS = 7 diff --git a/nsupdate/nsupdate/static/css/nsupdate.css b/nsupdate/nsupdate/static/css/nsupdate.css index 3108276..f151011 100644 --- a/nsupdate/nsupdate/static/css/nsupdate.css +++ b/nsupdate/nsupdate/static/css/nsupdate.css @@ -1,3 +1,3 @@ .content { - margin-top: 40px; + margin-top: 70px; } diff --git a/nsupdate/nsupdate/templates/registration/activate.html b/nsupdate/nsupdate/templates/registration/activate.html new file mode 100644 index 0000000..4a869d1 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/activate.html @@ -0,0 +1,14 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% url 'auth_login' as auth_login_url %} +{% block title %}{% if account %}{% trans "Activation complete" %}{% else %}{% trans "Activation problem" %}{% endif %}{% endblock %} +{% block content %} +{% if account %} +{% blocktrans %} +Thanks {{ account }}, activation complete! +You may now login using the username and password you set at registration. +{% endblocktrans %} +{% else %} +{% blocktrans %}Oops – it seems that your activation key is invalid. Please check the url again.{% endblocktrans %} +{% endif %} +{% endblock %} diff --git a/nsupdate/nsupdate/templates/registration/activation_complete.html b/nsupdate/nsupdate/templates/registration/activation_complete.html new file mode 100644 index 0000000..77da5d1 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/activation_complete.html @@ -0,0 +1,11 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% url 'auth_login' as auth_login_url %} +{% block title %}{% trans "Activation complete" %}{% endblock %} +{% block content %} +{% blocktrans %} +Thanks, activation complete! You may now login using the username and password you set at registration. +{% endblocktrans %} +{% endblock %} + + diff --git a/nsupdate/nsupdate/templates/registration/activation_email.html b/nsupdate/nsupdate/templates/registration/activation_email.html new file mode 100644 index 0000000..c6ebc26 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/activation_email.html @@ -0,0 +1,26 @@ +{% load i18n %} +{% comment %} +This template is used for the html alternative of the activation email +if you use a django-registration backend that looks for it. e.g. +https://github.com/huseyinyilmaz/django-registration-extended-backend +{% endcomment %} +{% url 'registration_activate' activation_key as activation_key_url %} +{% blocktrans with sitename=site.name sitedomain=site.domain%} +

Account registration for {{ sitename }}

+

+You (or someone pretending to be you) have asked to register an account at +{{ sitename }}.
+If this wasn't you, please ignore this email and your address will be removed +from our records. +

+

+To activate this account, please click the following link within the next +{{ expiration_days }} days:
+http://{{ sitedomain }}{{ activation_key_url }} +

+

+Sincerely,
+{{ sitename }} Management +

+ +{% endblocktrans %} \ No newline at end of file diff --git a/nsupdate/nsupdate/templates/registration/activation_email.txt b/nsupdate/nsupdate/templates/registration/activation_email.txt new file mode 100644 index 0000000..9ca54b3 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/activation_email.txt @@ -0,0 +1,15 @@ +{% load i18n %} +{% url 'registration_activate' activation_key as activation_key_url%} +{% blocktrans with sitename=site.name siteurl=site.domain %} +You (or someone pretending to be you) have asked to register an account at +{{ sitename }}. If this wasn't you, please ignore this email +and your address will be removed from our records. + +To activate this account, please click the following link within the next +{{ expiration_days }} days: + +http://{{ siteurl }}{{ activation_key_url }} + +Sincerely, +{{ sitename }} Management +{% endblocktrans %} \ No newline at end of file diff --git a/nsupdate/nsupdate/templates/registration/activation_email_subject.txt b/nsupdate/nsupdate/templates/registration/activation_email_subject.txt new file mode 100644 index 0000000..bdb8399 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/activation_email_subject.txt @@ -0,0 +1 @@ +{% load i18n %}{% blocktrans with sitename=site.name %}Account registration for {{ sitename }}{% endblocktrans %} diff --git a/nsupdate/nsupdate/templates/registration/login.html b/nsupdate/nsupdate/templates/registration/login.html new file mode 100644 index 0000000..0bacc2d --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/login.html @@ -0,0 +1,30 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% url 'auth_password_reset' as auth_pwd_reset_url %} +{% url 'registration_register' as register_url%} +{% block title %}{% trans "Login" %}{% endblock %} +{% block content %} + +{% if form.errors %} +

{% blocktrans %}Your username and password didn't match. Please try again.{% endblocktrans %}

+{% endif %} + +
{% csrf_token %} + + + + + + + + + +
{% trans form.username.label_tag %}{{ form.username }}
{% trans form.password.label_tag %}{{ form.password }}
+

{% blocktrans %}Forgot your password? + Need an account?{% endblocktrans %}

+ + + +
+ +{% endblock %} diff --git a/nsupdate/nsupdate/templates/registration/logout.html b/nsupdate/nsupdate/templates/registration/logout.html new file mode 100644 index 0000000..6759e11 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/logout.html @@ -0,0 +1,6 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Logged out" %}{% endblock %} +{% block content %} +{% trans "Successfully logged out!" %} +{% endblock %} diff --git a/nsupdate/nsupdate/templates/registration/password_change_done.html b/nsupdate/nsupdate/templates/registration/password_change_done.html new file mode 100644 index 0000000..d49d6cc --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/password_change_done.html @@ -0,0 +1,7 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Password changed" %}{% endblock %} +{% block content %} +{% trans "Password successfully changed!" %} +{% endblock %} + diff --git a/nsupdate/nsupdate/templates/registration/password_change_form.html b/nsupdate/nsupdate/templates/registration/password_change_form.html new file mode 100644 index 0000000..9e04d04 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/password_change_form.html @@ -0,0 +1,11 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Change password" %}{% endblock %} +{% block content %} +
{% csrf_token %} + + {{ form }} + +
+
+{% endblock %} diff --git a/nsupdate/nsupdate/templates/registration/password_reset_complete.html b/nsupdate/nsupdate/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..064701e --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/password_reset_complete.html @@ -0,0 +1,6 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Password reset complete" %}{% endblock %} +{% block content %}{% blocktrans %} +Your password has been reset! You may now log in. +{% endblocktrans %}{% endblock %} diff --git a/nsupdate/nsupdate/templates/registration/password_reset_confirm.html b/nsupdate/nsupdate/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..5006abd --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/password_reset_confirm.html @@ -0,0 +1,12 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Confirm password reset" %}{% endblock %} +{% block content %} +{% trans "Enter your new password below to reset your password:" %} +
{% csrf_token %} + + {{ form.as_table }} + +
+
+{% endblock %} diff --git a/nsupdate/nsupdate/templates/registration/password_reset_done.html b/nsupdate/nsupdate/templates/registration/password_reset_done.html new file mode 100644 index 0000000..9d283e3 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/password_reset_done.html @@ -0,0 +1,9 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Password reset" %}{% endblock %} +{% block content %} +

+{% blocktrans %}We have sent you an email with a link to reset your password. +Please check your email and click the link to continue.{% endblocktrans %} +

+{% endblock %} diff --git a/nsupdate/nsupdate/templates/registration/password_reset_email.html b/nsupdate/nsupdate/templates/registration/password_reset_email.html new file mode 100644 index 0000000..287737f --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/password_reset_email.html @@ -0,0 +1,17 @@ +{% load i18n %}{% trans "Greetings" %} {% if user.get_full_name %}{{ user.get_full_name }}{% else %}{{ user }}{% endif %}, + +{% blocktrans %}You are receiving this email because you (or someone pretending to be you) +requested that your password be reset on the {{ domain }} site. If you do not +wish to reset your password, please ignore this message. + +To reset your password, please click the following link, or copy and paste it +into your web browser:{% endblocktrans %} + +{{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %} + +{% blocktrans with username=user.username %} +Your username, in case you've forgotten: {{ username }} + +Best regards, +{{ site_name }} Management +{% endblocktrans %} \ No newline at end of file diff --git a/nsupdate/nsupdate/templates/registration/password_reset_form.html b/nsupdate/nsupdate/templates/registration/password_reset_form.html new file mode 100644 index 0000000..35811fe --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/password_reset_form.html @@ -0,0 +1,13 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Reset password" %}{% endblock %} +{% block content %}{% blocktrans %} +Forgot your password? Enter your email in the form below and we'll send you +instructions for creating a new one.{% endblocktrans %} +
{% csrf_token %} + + {{ form }} + +
+
+{% endblock %} diff --git a/nsupdate/nsupdate/templates/registration/registration_base.html b/nsupdate/nsupdate/templates/registration/registration_base.html new file mode 100644 index 0000000..c4c0b0f --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/registration_base.html @@ -0,0 +1,2 @@ +{% extends "base.html" %} +{% load i18n %} diff --git a/nsupdate/nsupdate/templates/registration/registration_complete.html b/nsupdate/nsupdate/templates/registration/registration_complete.html new file mode 100644 index 0000000..872292b --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/registration_complete.html @@ -0,0 +1,8 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% block title %}{% trans "Activation email sent" %}{% endblock %} +{% block content %} +{% blocktrans %}An activation email has been sent. +Please check your email and click on the link to activate your account.{% endblocktrans %} +{% endblock %} + diff --git a/nsupdate/nsupdate/templates/registration/registration_form.html b/nsupdate/nsupdate/templates/registration/registration_form.html new file mode 100644 index 0000000..b4f0533 --- /dev/null +++ b/nsupdate/nsupdate/templates/registration/registration_form.html @@ -0,0 +1,11 @@ +{% extends "registration/registration_base.html" %} +{% load i18n %} +{% load bootstrap %} +{% block title %}{% trans "Register for an account" %}{% endblock %} +{% block content %} +

Register new account

+
{% csrf_token %} + {{ form|bootstrap }} + +
+{% endblock %} diff --git a/nsupdate/nsupdate/urls.py b/nsupdate/nsupdate/urls.py index 65a379f..8e8508d 100644 --- a/nsupdate/nsupdate/urls.py +++ b/nsupdate/nsupdate/urls.py @@ -5,6 +5,7 @@ from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', + url(r'^accounts/', include('registration.backends.default.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^', include('main.urls')), ) diff --git a/requirements.d/all.txt b/requirements.d/all.txt index 561cd39..a88ba2f 100644 --- a/requirements.d/all.txt +++ b/requirements.d/all.txt @@ -1,2 +1,4 @@ django==1.5.4 south +django-bootstrap-form +django-registration