diff --git a/organon/settings.py b/organon/settings.py index 8216ab420767e6a45481a775cfe933af9105452e..4b05808dcdedcf30ab55bb287dd1d828ba0b2e07 100644 --- a/organon/settings.py +++ b/organon/settings.py @@ -27,6 +27,9 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'rest_framework', + 'rest_framework.authtoken', + 'rest_auth', + 'django_filters', 'compressor', @@ -106,8 +109,14 @@ STATICFILES_FINDERS = ( ) -# Django registration -ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value. +# cf +REST_FRAMEWORK = { + 'DEFAULT_AUTHENTICATION_CLASSES': ( + # 'rest_framework.authentication.TokenAuthentication', + 'playground.authentication.CsrfExemptSessionAuthentication', + 'rest_framework.authentication.BasicAuthentication' + ) +} # Django Compressor setup COMPRESS_PRECOMPILERS = ( diff --git a/organon/templates/registration/activate.html b/organon/templates/registration/activate.html deleted file mode 100755 index 3a7a13638e61417e21ba06f7576f5a4cec5c1fa6..0000000000000000000000000000000000000000 --- a/organon/templates/registration/activate.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Activation Failure" %}{% endblock %} - -{% block content %} -

{% trans "Account activation failed." %}

-{% endblock %} - - -{% comment %} -**registration/activate.html** - -Used if account activation fails. With the default setup, has the following context: - -``activation_key`` - The activation key used during the activation attempt. -{% endcomment %} diff --git a/organon/templates/registration/activation_complete.html b/organon/templates/registration/activation_complete.html deleted file mode 100755 index b66e0d6d76b5d962c237da211e208191af34718e..0000000000000000000000000000000000000000 --- a/organon/templates/registration/activation_complete.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Account Activated" %}{% endblock %} - -{% block content %} -

- {% trans "Your account is now activated." %} - {% if not user.is_authenticated %} - {% trans "You can log in." %} - {% endif %} -

-{% endblock %} - - -{% comment %} -**registration/activation_complete.html** - -Used after successful account activation. This template has no context -variables of its own, and should simply inform the user that their -account is now active. -{% endcomment %} diff --git a/organon/templates/registration/activation_complete_admin_pending.html b/organon/templates/registration/activation_complete_admin_pending.html deleted file mode 100755 index 25357ca9508e767b6fcb919e55e4fe1bee7480cc..0000000000000000000000000000000000000000 --- a/organon/templates/registration/activation_complete_admin_pending.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Account Activated" %}{% endblock %} - -{% block content %} -

- {% trans "Your account is now activated." %} - {% if not user.is_authenticated %} - {% trans "Once a site administrator activates your account you can login." %} - {% endif %} -

-{% endblock %} - - -{% comment %} -**registration/activation_complete.html** - -Used after successful account activation. This template has no context -variables of its own, and should simply inform the user that their -account is now active. -{% endcomment %} diff --git a/organon/templates/registration/activation_email.html b/organon/templates/registration/activation_email.html deleted file mode 100755 index cee8f9d2095adc94d0b0f66ac98c80259df1c871..0000000000000000000000000000000000000000 --- a/organon/templates/registration/activation_email.html +++ /dev/null @@ -1,72 +0,0 @@ -{% load i18n %} - - - - - {{ site.name }} {% trans "registration" %} - - - -

- {% blocktrans with site_name=site.name %} - You (or someone pretending to be you) have asked to register an account at - {{ site_name }}. If this wasn't you, please ignore this email - and your address will be removed from our records. - {% endblocktrans %} -

-

- {% blocktrans %} - To activate this account, please click the following link within the next - {{ expiration_days }} days: - {% endblocktrans %} -

- -

- - {{site.domain}}{% url 'registration_activate' activation_key %} - -

-

- {% blocktrans with site_name=site.name %} - Sincerely, - {{ site_name }} Management - {% endblocktrans %} -

- - - - - -{% comment %} -**registration/activation_email.html** - -Used to generate the html body of the activation email. Should display a -link the user can click to activate the account. This template has the -following context: - -``activation_key`` - The activation key for the new account. - -``expiration_days`` - The number of days remaining during which the account may be - activated. - -``site`` - An object representing the site on which the user registered; - depending on whether ``django.contrib.sites`` is installed, this - may be an instance of either ``django.contrib.sites.models.Site`` - (if the sites application is installed) or - ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the - documentation for the Django sites framework - `_ for - details regarding these objects' interfaces. - -``user`` - The new user account - -``request`` - ``HttpRequest`` instance for better flexibility. - For example it can be used to compute absolute register URL: - - {{ request.scheme }}://{{ request.get_host }}{% url 'registration_activate' activation_key %} -{% endcomment %} diff --git a/organon/templates/registration/activation_email.txt b/organon/templates/registration/activation_email.txt deleted file mode 100755 index 303d7ed3e5389e663714b4bee8fcaf0dc1564dbf..0000000000000000000000000000000000000000 --- a/organon/templates/registration/activation_email.txt +++ /dev/null @@ -1,52 +0,0 @@ -{% load i18n %} -{% blocktrans with site_name=site.name %} -You (or someone pretending to be you) have asked to register an account at -{{ site_name }}. If this wasn't you, please ignore this email -and your address will be removed from our records. -{% endblocktrans %} -{% blocktrans %} -To activate this account, please click the following link within the next -{{ expiration_days }} days: -{% endblocktrans %} - -http://{{site.domain}}{% url 'registration_activate' activation_key %} - -{% blocktrans with site_name=site.name %} -Sincerely, -{{ site_name }} Management -{% endblocktrans %} - - -{% comment %} -**registration/activation_email.txt** - -Used to generate the text body of the activation email. Should display a -link the user can click to activate the account. This template has the -following context: - -``activation_key`` - The activation key for the new account. - -``expiration_days`` - The number of days remaining during which the account may be - activated. - -``site`` - An object representing the site on which the user registered; - depending on whether ``django.contrib.sites`` is installed, this - may be an instance of either ``django.contrib.sites.models.Site`` - (if the sites application is installed) or - ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the - documentation for the Django sites framework - `_ for - details regarding these objects' interfaces. - -``user`` - The new user account - -``request`` - ``HttpRequest`` instance for better flexibility. - For example it can be used to compute absolute register URL: - - {{ request.scheme }}://{{ request.get_host }}{% url 'registration_activate' activation_key %} -{% endcomment %} diff --git a/organon/templates/registration/activation_email_subject.txt b/organon/templates/registration/activation_email_subject.txt deleted file mode 100755 index da0ddebb2e4190865deba06ae2adda9a6d015d80..0000000000000000000000000000000000000000 --- a/organon/templates/registration/activation_email_subject.txt +++ /dev/null @@ -1,28 +0,0 @@ -{% load i18n %}{% trans "Account activation on" %} {{ site.name }} - - -{% comment %} -**registration/activation_email_subject.txt** - -Used to generate the subject line of the activation email. Because the -subject line of an email must be a single line of text, any output -from this template will be forcibly condensed to a single line before -being used. This template has the following context: - -``activation_key`` - The activation key for the new account. - -``expiration_days`` - The number of days remaining during which the account may be - activated. - -``site`` - An object representing the site on which the user registered; - depending on whether ``django.contrib.sites`` is installed, this - may be an instance of either ``django.contrib.sites.models.Site`` - (if the sites application is installed) or - ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the - documentation for the Django sites framework - `_ for - details regarding these objects' interfaces. -{% endcomment %} diff --git a/organon/templates/registration/admin_approve.html b/organon/templates/registration/admin_approve.html deleted file mode 100755 index 487c1fb93d8132694eaae0d295ccd152723addc4..0000000000000000000000000000000000000000 --- a/organon/templates/registration/admin_approve.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Approval Failure" %}{% endblock %} - -{% block content %} -

{% trans "Account Approval failed." %}

-{% endblock %} - - -{% comment %} -**registration/admin_approve.html** - -Used if account activation fails. With the default setup, has the following context: - -``activation_key`` - The activation key used during the activation attempt. -{% endcomment %} diff --git a/organon/templates/registration/admin_approve_complete.html b/organon/templates/registration/admin_approve_complete.html deleted file mode 100755 index 17ab434551794943e40cfa8c89be5324837b9eb4..0000000000000000000000000000000000000000 --- a/organon/templates/registration/admin_approve_complete.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Account Approved" %}{% endblock %} - -{% block content %} -

- {% trans "The user's account is now approved." %} -

-{% endblock %} - - -{% comment %} -**registration/admin_approve_complete.html** - -Used after admin successfully approves a user's account. This template has no context -variables of its own, and should simply inform the admin that the user's -account is now active. -{% endcomment %} diff --git a/organon/templates/registration/admin_approve_complete_email.html b/organon/templates/registration/admin_approve_complete_email.html deleted file mode 100755 index d1f978fabe52aa321404c10755b2b941edce8346..0000000000000000000000000000000000000000 --- a/organon/templates/registration/admin_approve_complete_email.html +++ /dev/null @@ -1,27 +0,0 @@ -{% load i18n %} - - - - - {{ site.name }} {% trans "admin approval" %} - - - -

- {% blocktrans %} - Your account is now approved. You can - {% endblocktrans %} - {% trans "log in." %} -

- - - - - -{% comment %} -**registration/admin_approve_complete_email.html** - -Used after successful account activation. This template has no context -variables of its own, and should simply inform the user that their -account is now active. -{% endcomment %} diff --git a/organon/templates/registration/admin_approve_complete_email.txt b/organon/templates/registration/admin_approve_complete_email.txt deleted file mode 100755 index 97d6dee3b3edf3a909076a278303cd9fd59bebcf..0000000000000000000000000000000000000000 --- a/organon/templates/registration/admin_approve_complete_email.txt +++ /dev/null @@ -1,13 +0,0 @@ -{% load i18n %} -{% blocktrans %} -Your account is now approved. You can log in using the following link -{% endblocktrans %} -http://{{site.domain}}{% url 'login' %} - -{% comment %} -**registration/admin_approve_complete_email.txt** - -Used after successful account activation. This template has no context -variables of its own, and should simply inform the user that their -account is now active. -{% endcomment %} diff --git a/organon/templates/registration/admin_approve_complete_email_subject.txt b/organon/templates/registration/admin_approve_complete_email_subject.txt deleted file mode 100755 index 6dac1dbf851a4c387c2fc6d312c01531aa7ad072..0000000000000000000000000000000000000000 --- a/organon/templates/registration/admin_approve_complete_email_subject.txt +++ /dev/null @@ -1,21 +0,0 @@ -{% load i18n %}{% trans "Account activation on" %} {{ site.name }} - - -{% comment %} -**registration/admin_approve_complete_email_subject.txt** - -Used to generate the subject line of the admin approval complete email. Because -the subject line of an email must be a single line of text, any output -from this template will be forcibly condensed to a single line before -being used. This template has the following context: - -``site`` - An object representing the site on which the user registered; - depending on whether ``django.contrib.sites`` is installed, this - may be an instance of either ``django.contrib.sites.models.Site`` - (if the sites application is installed) or - ``django.contrib.sites.requests.RequestSite`` (if not). Consult `the - documentation for the Django sites framework - `_ for - details regarding these objects' interfaces. -{% endcomment %} diff --git a/organon/templates/registration/admin_approve_email.html b/organon/templates/registration/admin_approve_email.html deleted file mode 100755 index 0a02ae6036055e8695958954a278d11710ededd2..0000000000000000000000000000000000000000 --- a/organon/templates/registration/admin_approve_email.html +++ /dev/null @@ -1,30 +0,0 @@ -{% load i18n %} - - - - - {{ site.name }} {% trans "registration" %} - - - -

- {% blocktrans with site_name=site.name %} - The following user ({{ user }}) has asked to register an account at - {{ site_name }}. - {% endblocktrans %} -

-

- {% blocktrans %} - To approve this, please - {% endblocktrans %} - {% trans "click here" %}. -

-

- {% blocktrans with site_name=site.name %} - Sincerely, - {{ site_name }} Management - {% endblocktrans %} -

- - - \ No newline at end of file diff --git a/organon/templates/registration/admin_approve_email.txt b/organon/templates/registration/admin_approve_email.txt deleted file mode 100755 index ea3bddd71d66591756d8e2bb7e7a2a30658c9ae0..0000000000000000000000000000000000000000 --- a/organon/templates/registration/admin_approve_email.txt +++ /dev/null @@ -1,10 +0,0 @@ -{% load i18n %} -{% blocktrans with site_name=site.name %} -The following user ({{ user }}) has asked to register an account at -{{ site_name }}. -{% endblocktrans %} -{% blocktrans %} -To approve this, please click the following link. -{% endblocktrans %} - -http://{{site.domain}}{% url 'registration_admin_approve' profile_id %} \ No newline at end of file diff --git a/organon/templates/registration/admin_approve_email_subject.txt b/organon/templates/registration/admin_approve_email_subject.txt deleted file mode 100755 index 3cd2bd9e490d42d7566db1a3c30b21a4a1589403..0000000000000000000000000000000000000000 --- a/organon/templates/registration/admin_approve_email_subject.txt +++ /dev/null @@ -1 +0,0 @@ -{% load i18n %}{% trans "Account approval on" %} {{ site.name }} diff --git a/organon/templates/registration/login.html b/organon/templates/registration/login.html deleted file mode 100755 index 2e029badb4d1a3e81a91b3cdc784fe02c23bf5a8..0000000000000000000000000000000000000000 --- a/organon/templates/registration/login.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Log in" %}{% endblock %} - -{% block content %} -
- {% csrf_token %} - {{ form.as_p }} - - -
- -

{% trans "Forgot your password?" %} {% trans "Reset it" %}.

-

{% trans "Not a member?" %} {% trans "Register" %}.

-{% endblock %} - - -{% comment %} -**registration/login.html** - -It's your responsibility to provide the login form in a template called -registration/login.html by default. This template gets passed four -template context variables: - -``form`` - A Form object representing the login form. See the forms - documentation for more on Form objects. - -``next`` - The URL to redirect to after successful login. This may contain a - query string, too. - -``site`` - The current Site, according to the SITE_ID setting. If you don't - have the site framework installed, this will be set to an instance - of RequestSite, which derives the site name and domain from the - current HttpRequest. - -``site_name`` - An alias for site.name. If you don't have the site framework - installed, this will be set to the value of - request.META['SERVER_NAME']. For more on sites, see The - "sites" framework. -{% endcomment %} diff --git a/organon/templates/registration/logout.html b/organon/templates/registration/logout.html deleted file mode 100755 index e93d840640acbfbef6af14d0ac5fc370f6761f33..0000000000000000000000000000000000000000 --- a/organon/templates/registration/logout.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Logged out" %}{% endblock %} - -{% block content %} -

{% trans "Successfully logged out" %}.

-{% endblock %} diff --git a/organon/templates/registration/password_change_done.html b/organon/templates/registration/password_change_done.html deleted file mode 100755 index f886aa4833b8fe340b919a144fb24840b41236da..0000000000000000000000000000000000000000 --- a/organon/templates/registration/password_change_done.html +++ /dev/null @@ -1,11 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Password changed" %}{% endblock %} - -{% block content %} -

{% trans "Password successfully changed!" %}

-{% endblock %} - - -{# This is used by django.contrib.auth #} diff --git a/organon/templates/registration/password_change_form.html b/organon/templates/registration/password_change_form.html deleted file mode 100755 index 6be761f85f26ca310836000969cedb9925d17bb9..0000000000000000000000000000000000000000 --- a/organon/templates/registration/password_change_form.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Change password" %}{% endblock %} - -{% block content %} -
- {% csrf_token %} - {{ form.as_p }} - -
-{% endblock %} - - -{# This is used by django.contrib.auth #} diff --git a/organon/templates/registration/password_reset_complete.html b/organon/templates/registration/password_reset_complete.html deleted file mode 100755 index 00b755a23bab68ddb9556a30c9e56d01ab33d549..0000000000000000000000000000000000000000 --- a/organon/templates/registration/password_reset_complete.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Password reset complete" %}{% endblock %} - -{% block content %} -

- {% trans "Your password has been reset!" %} - {% blocktrans %}You may now log in{% endblocktrans %}. - -

-{% endblock %} - - -{# This is used by django.contrib.auth #} diff --git a/organon/templates/registration/password_reset_confirm.html b/organon/templates/registration/password_reset_confirm.html deleted file mode 100755 index aa34753853ce4ad1779f75680b4456679b6055cb..0000000000000000000000000000000000000000 --- a/organon/templates/registration/password_reset_confirm.html +++ /dev/null @@ -1,16 +0,0 @@ -{% 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_p }} - -
-{% endblock %} - - -{# This is used by django.contrib.auth #} diff --git a/organon/templates/registration/password_reset_done.html b/organon/templates/registration/password_reset_done.html deleted file mode 100755 index 8624a51d8ab23c35053a0e3fb9f8f64532397ad5..0000000000000000000000000000000000000000 --- a/organon/templates/registration/password_reset_done.html +++ /dev/null @@ -1,16 +0,0 @@ -{% 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 %} - - -{# This is used by django.contrib.auth #} diff --git a/organon/templates/registration/password_reset_email.html b/organon/templates/registration/password_reset_email.html deleted file mode 100755 index 1eee2e27dd0b5a7dfc0858e5c02e758b9b061e98..0000000000000000000000000000000000000000 --- a/organon/templates/registration/password_reset_email.html +++ /dev/null @@ -1,25 +0,0 @@ -{% load i18n %} - -{% blocktrans %}Greetings{% endblocktrans %} {% 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. -{% endblocktrans %} - -{% blocktrans %} -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 %}Your username, in case you've forgotten:{% endblocktrans %} {{ user.username }} - - -{% blocktrans %}Best regards{% endblocktrans %}, -{{ site_name }} {% blocktrans %}Management{% endblocktrans %} - - -{# This is used by django.contrib.auth #} diff --git a/organon/templates/registration/password_reset_form.html b/organon/templates/registration/password_reset_form.html deleted file mode 100755 index 27ed5c49074a84be2fe78cfd842e1fcd1ea2f494..0000000000000000000000000000000000000000 --- a/organon/templates/registration/password_reset_form.html +++ /dev/null @@ -1,20 +0,0 @@ -{% 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.as_p }} - -
-{% endblock %} - - -{# This is used by django.contrib.auth #} diff --git a/organon/templates/registration/registration_base.html b/organon/templates/registration/registration_base.html deleted file mode 100755 index 94d9808cc760156cb7ab46e326c0267f3406125e..0000000000000000000000000000000000000000 --- a/organon/templates/registration/registration_base.html +++ /dev/null @@ -1 +0,0 @@ -{% extends "base.html" %} diff --git a/organon/templates/registration/registration_closed.html b/organon/templates/registration/registration_closed.html deleted file mode 100755 index 94daff101a6f507e5c33ecde2637619a5fc272f5..0000000000000000000000000000000000000000 --- a/organon/templates/registration/registration_closed.html +++ /dev/null @@ -1,8 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Registration is closed" %}{% endblock %} - -{% block content %} -

{% trans "Sorry, but registration is closed at this moment. Come back later." %}

-{% endblock %} diff --git a/organon/templates/registration/registration_complete.html b/organon/templates/registration/registration_complete.html deleted file mode 100755 index f0d0596b6d1be6f7865ea9e592296891102b52c9..0000000000000000000000000000000000000000 --- a/organon/templates/registration/registration_complete.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Activation email sent" %}{% endblock %} - -{% block content %} -

{% trans "Please check your email to complete the registration process." %}

-{% endblock %} - - -{% comment %} -**registration/registration_complete.html** - -Used after successful completion of the registration form. This -template has no context variables of its own, and should simply inform -the user that an email containing account-activation information has -been sent. -{% endcomment %} diff --git a/organon/templates/registration/registration_form.html b/organon/templates/registration/registration_form.html deleted file mode 100755 index 42b4051b4c0b1d5e45b0bfe74e35bb4df853414f..0000000000000000000000000000000000000000 --- a/organon/templates/registration/registration_form.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Register for an account" %}{% endblock %} - -{% block content %} -
- {% csrf_token %} - {{ form.as_p }} - -
-{% endblock %} - - -{% comment %} -**registration/registration_form.html** -Used to show the form users will fill out to register. By default, has -the following context: - -``form`` - The registration form. This will be an instance of some subclass - of ``django.forms.Form``; consult `Django's forms documentation - `_ for - information on how to display this in a template. -{% endcomment %} diff --git a/organon/templates/registration/resend_activation_complete.html b/organon/templates/registration/resend_activation_complete.html deleted file mode 100755 index 800e75ed629dc6cfdcb3f8336226c1ae936d727d..0000000000000000000000000000000000000000 --- a/organon/templates/registration/resend_activation_complete.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Account Activation Resent" %}{% endblock %} - -{% block content %} -

- {% blocktrans %} - We have sent an email to {{ email }} with further instructions. - {% endblocktrans %} -

-{% endblock %} - - -{% comment %} -**registration/resend_activation_complete.html** -Used after form for resending account activation is submitted. By default has -the following context: - -``email`` - The email address submitted in the resend activation form. -{% endcomment %} diff --git a/organon/templates/registration/resend_activation_form.html b/organon/templates/registration/resend_activation_form.html deleted file mode 100755 index 400384d85bb98fa49b7eb6f73df8fdf5613c0de0..0000000000000000000000000000000000000000 --- a/organon/templates/registration/resend_activation_form.html +++ /dev/null @@ -1,25 +0,0 @@ -{% extends "registration/registration_base.html" %} -{% load i18n %} - -{% block title %}{% trans "Resend Activation Email" %}{% endblock %} - -{% block content %} -
- {% csrf_token %} - {{ form.as_p }} - -
-{% endblock %} - - -{% comment %} -**registration/resend_activation_form.html** -Used to show the form users will fill out to resend the activation email. By -default, has the following context: - -``form`` - The registration form. This will be an instance of some subclass - of ``django.forms.Form``; consult `Django's forms documentation - `_ for - information on how to display this in a template. -{% endcomment %} diff --git a/organon/urls.py b/organon/urls.py index 0179c424ebe1c068b533d8a7b7e28ed5b546e9ee..a212092c458a24894ade64dbbaac45669959ce35 100644 --- a/organon/urls.py +++ b/organon/urls.py @@ -27,10 +27,10 @@ router.register(r'scores', views.ScoreViewSet) urlpatterns = [ url(r'^admin/', admin.site.urls), - url(r'^accounts/', include('registration.backends.hmac.urls')), url(r'^api/', include(router.urls)), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), + url(r'^rest-auth/', include('rest_auth.urls')), url(r'^', include('playground.urls')), ] diff --git a/playground/authentication.py b/playground/authentication.py new file mode 100644 index 0000000000000000000000000000000000000000..60ee8bd322dcefdabdc1d960f7d690f5b92522a6 --- /dev/null +++ b/playground/authentication.py @@ -0,0 +1,8 @@ +from rest_framework.authentication import SessionAuthentication, BasicAuthentication + +# cf +class CsrfExemptSessionAuthentication(SessionAuthentication): + + def enforce_csrf(self, request): + return # To not perform the csrf check previously happening + diff --git a/playground/static/playground/css/styles.css b/playground/static/playground/css/styles.css index 70cb95de9f7127c02a8fabd55ff42bda805e0398..db6d62ee01f6bf575b5589bf8e82f572ff079439 100644 --- a/playground/static/playground/css/styles.css +++ b/playground/static/playground/css/styles.css @@ -926,3 +926,48 @@ section.hidden { display: inline-block; padding-left: .25em; } + +.score-edit { + margin: 1em 0 1em 0; +} + + + + + + + +.modalDialog { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: rgba(0, 0, 0, 0.8); + z-index: 99999; + transition: opacity 400ms ease-in; +} +.modalDialog > div { + width: 400px; + position: relative; + margin: 10% auto; + padding: 5px 20px 13px 20px; + background: #fff; +} +.close { + background: #606061; + color: #FFFFFF; + line-height: 25px; + position: absolute; + right: -12px; + text-align: center; + top: -10px; + width: 24px; + text-decoration: none; + font-weight: bold; + border-radius: 12px; + box-shadow: 1px 1px 3px #000; +} +.close:hover { + background: #00d9ff; +} diff --git a/playground/static/playground/js/apps.js b/playground/static/playground/js/apps.js index 59a5c7efb1862aa71d9d5943b317e54ae77f9e22..8a218c639313280d53c16907fc43ea9937a4c5e4 100644 --- a/playground/static/playground/js/apps.js +++ b/playground/static/playground/js/apps.js @@ -10,7 +10,9 @@ window.W = window.W || {}; region: 'body', onStart: function(options) { - this.showView(new W.BaseView()); + var userModel = new W.UserModel(); + this.showView(new W.BaseView({model: userModel})); + userModel.fetch(); var router = new W.ScoreRouter({application: this}); diff --git a/playground/static/playground/js/controllers.js b/playground/static/playground/js/controllers.js index 79c8fad12d1808c9d6f69ecfba40f936c7883ab4..5dd6a6062b74f41ffb472d895ec721012c76cd29 100644 --- a/playground/static/playground/js/controllers.js +++ b/playground/static/playground/js/controllers.js @@ -17,6 +17,16 @@ window.W = window.W || {}; var view = new W.AboutView(); baseView.showChildView('main', view); }, + userList: function () { + var baseView = this.getOption('application').getView(); + var view = new W.UserListView(); + baseView.showChildView('main', view); + }, + userDetail: function () { + var baseView = this.getOption('application').getView(); + var view = new W.UserDetailView(); + baseView.showChildView('main', view); + }, scoreList: function () { var baseView = this.getOption('application').getView(); var view = new W.ScoreListView(); diff --git a/playground/static/playground/js/models.js b/playground/static/playground/js/models.js index e06b4f766bd4788291ce35142baef587f7468384..b167a0062429e0564293ee2cbe99032505d11d5a 100644 --- a/playground/static/playground/js/models.js +++ b/playground/static/playground/js/models.js @@ -6,6 +6,22 @@ window.W = window.W || {}; (function (undefined) { 'use strict'; + W.UserModel = Backbone.Model.extend({ + urlRoot: '/rest-auth/user/', + + defaults: { + username: "" + }, + + url: function () { + var original_url = Backbone.Model.prototype.url.call(this); + var parsed_url = original_url + (original_url.charAt(original_url.length - 1) == '/' ? '' : '/'); + + return parsed_url; + }, + }); + + W.ScoreModel = Backbone.RelationalModel.extend({ defaults: { title: "Untitled", @@ -87,7 +103,6 @@ window.W = window.W || {}; // console.log(data); return data; }, - }); diff --git a/playground/static/playground/js/routers.js b/playground/static/playground/js/routers.js index fe33d1b10cb6b86dcf2e72cf32f15eb81e7ec6fb..eca06815051efc0544e08440b4e369d4ceb7a97c 100644 --- a/playground/static/playground/js/routers.js +++ b/playground/static/playground/js/routers.js @@ -14,6 +14,8 @@ window.W = window.W || {}; 'apropos(/)': 'about', 'partitions(/)': 'scoreList', 'partitions/:id(/)': 'scoreDetail', + 'users/(/)': 'userList', + 'users/:id(/)': 'userDetail', }, initialize: function (options) { diff --git a/playground/static/playground/js/views.js b/playground/static/playground/js/views.js index 1db3f454e7e658c265c069d9e26cf7b841f19ca9..421cd031a5916c80610a158adaab34344240bd64 100644 --- a/playground/static/playground/js/views.js +++ b/playground/static/playground/js/views.js @@ -1456,6 +1456,110 @@ window.W = window.W || {}; }); + /** + * User views + */ + + + W.UserListView = Backbone.Marionette.View.extend({ + template: '#user-list-template', + }); + + + W.UserDetailView = Backbone.Marionette.View.extend({ + template: '#user-detail-template', + }); + + + W.LoginView = Backbone.Marionette.View.extend({ + template: '#login-template', + + ui: { + 'close': '.btn-close', + 'submit': '.btn-submit' + }, + + triggers: { + 'click @ui.close': 'hide:modal', + 'click @ui.submit': 'submit', + }, + + onSubmit: function (foo, event) { + event.preventDefault(); + + var model = this.model; + var that = this; + + var form = this.$el.find("form"); + var data = form.serialize(); + + $.ajax({ + type: "POST", + url: form.attr('action'), + data: form.serialize(), + success: function(data, textStatus, jqXHR) { + model.fetch(); + that.trigger('hide:modal'); + }, + error: function(xhr, ajaxOptions, thrownError){ + alert('login failed - please try again'); + }, + }); + } + }); + + + W.LogoutView = Backbone.Marionette.View.extend({ + template: '#logout-template', + + ui: { + 'close': '.btn-close', + 'submit': '.btn-submit' + }, + + triggers: { + 'click @ui.close': 'hide:modal', + 'click @ui.submit': 'submit' + }, + + onSubmit: function (foo, event) { + event.preventDefault(); + var that = this; + + var model = this.model; + var form = this.$el.find("form"); + + $.ajax({ + type: "POST", + url: form.attr('action'), + success: function(data, textStatus, jqXHR){ + that.trigger('hide:modal'); + alert("ok"); + model.set(model.defaults); + }, + error: function(xhr, ajaxOptions, thrownError){ + alert('logout failed - please try again'); + // that.trigger('hide:modal'); + // model.clear(); + }, + }); + } + }); + + + W.RegisterView = Backbone.Marionette.View.extend({ + template: '#register-template', + + ui: { + 'close': '.btn-close' + }, + + triggers: { + 'click @ui.close': 'hide:modal', + }, + }); + + /** * Other views */ @@ -1514,10 +1618,20 @@ window.W = window.W || {}; ui: { 'toggle': '.btn-hamburger', + 'login': '.btn-login', + 'logout': '.btn-logout', + 'register': '.btn-register', }, triggers: { 'click @ui.toggle': 'toggle', + 'click @ui.login': 'show:login', + 'click @ui.logout': 'show:logout', + 'click @ui.register': 'show:register', + }, + + initialize: function () { + this.listenTo(this.model, 'change', this.render); }, regions: { @@ -1556,11 +1670,38 @@ window.W = window.W || {}; main: { el: '.main-area', // replaceElement: true + }, + modal: { + el: '.modal', + // replaceElement: true } }, + childViewEvents: { + 'show:login': 'showLogin', + 'show:register': 'showRegister', + 'show:logout': 'showLogout', + 'hide:modal': 'hideModal' + }, + onRender: function () { - this.showChildView('header', new W.HeaderView()); - } + this.showChildView('header', new W.HeaderView({model: this.model})); + }, + + showLogin: function(event) { + this.showChildView('modal', new W.LoginView({model: this.model})); + }, + + showLogout: function(event) { + this.showChildView('modal', new W.LogoutView({model: this.model})); + }, + + showRegister: function(event) { + this.showChildView('modal', new W.RegisterView()); + }, + + hideModal: function(event) { + this.detachChildView('modal'); + }, }); })(); diff --git a/playground/templates/playground/score.html b/playground/templates/playground/score.html index f66f322d5ace8b8ddd718222cee4493d29856f7d..a185c420bc5aae5ce30b098cb7f73191b14a4a4f 100644 --- a/playground/templates/playground/score.html +++ b/playground/templates/playground/score.html @@ -27,10 +27,30 @@ {% include "playground/underscore/home.mtpl" %} + + + + + + + + + + diff --git a/playground/templates/playground/underscore/base.mtpl b/playground/templates/playground/underscore/base.mtpl index 2ea0f95ef3ae6bfb1e06583cbf374cc1ddfe4d51..8f41fd57b0aa4a4a64d8b757422d86b758e9e7ff 100644 --- a/playground/templates/playground/underscore/base.mtpl +++ b/playground/templates/playground/underscore/base.mtpl @@ -1,2 +1,3 @@
+ diff --git a/playground/templates/playground/underscore/header.mtpl b/playground/templates/playground/underscore/header.mtpl index 77ae49b57eac7466f578058c68c0bad4dd4eec13..0628705445096ba871416aa31f2aa185c9fa7d39 100644 --- a/playground/templates/playground/underscore/header.mtpl +++ b/playground/templates/playground/underscore/header.mtpl @@ -9,14 +9,19 @@
diff --git a/playground/templates/playground/underscore/login.mtpl b/playground/templates/playground/underscore/login.mtpl new file mode 100644 index 0000000000000000000000000000000000000000..36d4fbd6bdaa03debdba761b01747dde872fef39 --- /dev/null +++ b/playground/templates/playground/underscore/login.mtpl @@ -0,0 +1,15 @@ +
+
X + +

Log in (new)

+ +
+

+

+ +
+ + + +
+
diff --git a/playground/templates/playground/underscore/logout.mtpl b/playground/templates/playground/underscore/logout.mtpl new file mode 100644 index 0000000000000000000000000000000000000000..037d9c3d97a281853920b226097214654dc892b6 --- /dev/null +++ b/playground/templates/playground/underscore/logout.mtpl @@ -0,0 +1,10 @@ +
+
X + +

Etes-vous sur de vouloir vous deconnecter?

+ +
+

+
+
+
diff --git a/playground/templates/playground/underscore/register.mtpl b/playground/templates/playground/underscore/register.mtpl new file mode 100644 index 0000000000000000000000000000000000000000..0b09e6c87ad5bbcd4ed88e9b4e7e07f5dc9b8f2b --- /dev/null +++ b/playground/templates/playground/underscore/register.mtpl @@ -0,0 +1,15 @@ +
+
X + +

Register

+ +
+ +

Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.

+

email address

+

+

Enter the same password as before, for verification.

+ +
+
+
diff --git a/playground/templates/playground/underscore/user-detail.mtpl b/playground/templates/playground/underscore/user-detail.mtpl new file mode 100644 index 0000000000000000000000000000000000000000..ee4d517aeb1624fe2847594ba1d277572e9ea4d0 --- /dev/null +++ b/playground/templates/playground/underscore/user-detail.mtpl @@ -0,0 +1 @@ +

here comes the user detail

diff --git a/playground/templates/playground/underscore/user-list.mtpl b/playground/templates/playground/underscore/user-list.mtpl new file mode 100644 index 0000000000000000000000000000000000000000..d3b8d4eb648e87b45651f46d593c6b72c5820f61 --- /dev/null +++ b/playground/templates/playground/underscore/user-list.mtpl @@ -0,0 +1 @@ +

here comes the user list

diff --git a/requirements/base.txt b/requirements/base.txt index 18c087acb4b423c6700ca42a10c79643465868fd..b9dde204b5d501f52ace6015f8df12127b3c04bb 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,7 +1,7 @@ django>=1.10,<1.11 -django-registration djangorestframework djangorestframework-recursive +django-rest-auth psycopg2 django-filter django-compressor