Remove dj-user-accounts

That's a nice macro, but we don't need it.
dj-user-accounts stands in the way of using more generic AUTN_METHODS
This commit is contained in:
Sachi King 2017-03-26 15:14:27 +11:00
parent 48c28651b8
commit 9e851c31fa
41 changed files with 13 additions and 464 deletions

View file

@ -6,6 +6,3 @@ from django.apps import AppConfig as BaseAppConfig
class AppConfig(BaseAppConfig):
name = "pinaxcon"
def ready(self):
import_module("pinaxcon.receivers")

View file

@ -12,7 +12,6 @@ class MonkeyPatchMiddleware(object):
def do_monkey_patch():
patch_speaker_profile_form()
fix_sitetree_check_access_500s()
never_cache_login_page()
patch_stripe_payment_form()
# Remove this function from existence
@ -51,12 +50,6 @@ def fix_sitetree_check_access_500s():
SiteTree.check_access = check_access
def never_cache_login_page():
from django.views.decorators.cache import never_cache
from account.views import LoginView
LoginView.get = never_cache(LoginView.get)
def patch_stripe_payment_form(): # noqa: C901
import inspect # Oh no.

View file

@ -1,59 +0,0 @@
from django.dispatch import receiver
from account.signals import password_changed
from account.signals import user_sign_up_attempt, user_signed_up
from account.signals import user_login_attempt, user_logged_in
from pinax.eventlog.models import log
@receiver(user_logged_in)
def handle_user_logged_in(sender, **kwargs):
log(
user=kwargs.get("user"),
action="USER_LOGGED_IN",
extra={}
)
@receiver(password_changed)
def handle_password_changed(sender, **kwargs):
log(
user=kwargs.get("user"),
action="PASSWORD_CHANGED",
extra={}
)
@receiver(user_login_attempt)
def handle_user_login_attempt(sender, **kwargs):
log(
user=None,
action="LOGIN_ATTEMPTED",
extra={
"username": kwargs.get("username"),
"result": kwargs.get("result")
}
)
@receiver(user_sign_up_attempt)
def handle_user_sign_up_attempt(sender, **kwargs):
log(
user=None,
action="SIGNUP_ATTEMPTED",
extra={
"username": kwargs.get("username"),
"email": kwargs.get("email"),
"result": kwargs.get("result")
}
)
@receiver(user_signed_up)
def handle_user_signed_up(sender, **kwargs):
log(
user=kwargs.get("user"),
action="USER_SIGNED_UP",
extra={}
)

View file

@ -68,7 +68,6 @@ TEMPLATES = [
"django.core.context_processors.tz",
"django.core.context_processors.request",
"django.contrib.messages.context_processors.messages",
"account.context_processors.account",
"pinax_theme_bootstrap.context_processors.theme",
"symposion.reviews.context_processors.reviews",
],
@ -112,7 +111,6 @@ INSTALLED_APPS = [
"pinax_theme_bootstrap",
# external
"account",
"easy_thumbnails",
"taggit",
"reversion",
@ -241,20 +239,10 @@ FIXTURE_DIRS = [
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
ACCOUNT_OPEN_SIGNUP = True
ACCOUNT_EMAIL_UNIQUE = True
ACCOUNT_EMAIL_CONFIRMATION_REQUIRED = False
ACCOUNT_LOGIN_REDIRECT_URL = "dashboard"
ACCOUNT_LOGOUT_REDIRECT_URL = "/"
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2
ACCOUNT_USE_AUTH_AUTHENTICATE = True
THEME_CONTACT_EMAIL = "team@lca2018.org"
AUTHENTICATION_BACKENDS = [
"symposion.teams.backends.TeamPermissionsBackend",
"account.auth_backends.UsernameAuthenticationBackend",
"account.auth_backends.EmailAuthenticationBackend",
]
CONFERENCE_ID = 1

View file

@ -1,29 +0,0 @@
{% load i18n %}
{% load account_tags %}
<ul class="nav navbar-nav pull-right">
{% if request.user.is_authenticated %}
<span class="navbar-text">
<i class="fa fa-user"></i> {% user_display request.user %}
</span>
<li>
<a href="{% url "dashboard" %}"><i class="fa fa-tasks"></i> {% trans "Dashboard" %}</a>
</li>
<li>
<a href="{% url 'account_settings' %}"><i class="fa fa-cog"></i> {% trans "Settings" %}</a>
</li>
<li>
<a id="account_logout" href="{% url 'account_logout' %}"><i class="fa fa-power-off"></i> {% trans "Log out" %}</a>
</li>
{% else %}
<li><a href="{% url 'account_login' %}">{% trans "Log in" %}</a></li>
{% if ACCOUNT_OPEN_SIGNUP %}
<li><a href="{% url 'account_signup' %}">{% trans "Sign up" %}</a></li>
{% endif %}
{% endif %}
</ul>
<form id="accountLogOutForm" style="display: none;" action="{% url 'account_logout' %}" method="POST">
{% csrf_token %}
</form>

View file

@ -1 +0,0 @@
{# provide log in sidebar here #}

View file

@ -1 +0,0 @@
{# provide sign up in sidebar here #}

View file

@ -1,25 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% block body_class %}account{% endblock %}
{% block utility_body %}
<div class="btn-group">
<a class="btn {% block btn-settings %}{% endblock %}" href="{% url "account_settings" %}">
{% trans "Settings" %}
</a>
<a class="btn {% block btn-password %}{% endblock %}" href="{% url "account_password" %}">
{% trans "Change password" %}
</a>
<a class="btn {% block btn-delete %}{% endblock %}" href="{% url "account_delete" %}">
{% trans "Delete account" %}
</a>
</div>
<br />
{% block account_body %}
{% endblock %}
{% endblock %}

View file

@ -1,20 +0,0 @@
{% extends "account/base.html" %}
{% load i18n %}
{% block body_class %}account account-delete{% endblock %}
{% block head_title %}{% trans "Delete Account" %}{% endblock %}
{% block page_title %}{% trans "Delete Account" %}{% endblock %}
{% block btn-delete %}btn__active{% endblock %}
{% block account_body %}
<p>{% blocktrans %}If you go ahead and delete your account, your information will be <b>expunged within {{ ACCOUNT_DELETION_EXPUNGE_HOURS }} hours</b>.{% endblocktrans %}</p>
<form method="post" action="{% url "account_delete" %}" autocapitalize="off">
{% csrf_token %}
<button type="submit" class="btn btn-danger">{% trans "Delete My Account" %}</button>
</form>
{% endblock %}

View file

@ -1,6 +0,0 @@
{% load i18n account_tags %}{% blocktrans with site_name=current_site.name %}A user on {{ site_name }} has created an account using this email address.
To confirm this email address, go to {{ activate_url }}
If you did not sign up for this site, you can ignore this message.
{% endblocktrans %}

View file

@ -1 +0,0 @@
{% load i18n %}{% blocktrans with site_name=current_site.name %}Confirm email address for {{ site_name }}{% endblocktrans %}

View file

@ -1,4 +0,0 @@
{% load i18n %}{% blocktrans with name=current_site.name %}You have been invited to sign up at {{ name }}.
{{ signup_url }}
{% endblocktrans %}

View file

@ -1 +0,0 @@
{% load i18n %}{% blocktrans with name=current_site.name %}Create an account on {{ name }}{% endblocktrans %}

View file

@ -1 +0,0 @@
{% load i18n %}{% blocktrans with now=user.account.now %}This is the email notification to confirm your password has been changed on {{ now }}.{% endblocktrans %}

View file

@ -1 +0,0 @@
{% load i18n %}{% trans "Change password email notification" %}

View file

@ -1,5 +0,0 @@
{% load i18n %}{% blocktrans with site_name=current_site.name %}You're receiving this email because you or someone else has requested a password for your user account at {{ site_name }}.
It can be safely ignored if you did not request a password reset. Click the link below to reset your password.
{{ password_reset_url }}
{% endblocktrans %}

View file

@ -1 +0,0 @@
{% load i18n %}{% blocktrans with site_name=current_site.name %}[{{ site_name }}] Password reset{% endblocktrans %}

View file

@ -1,16 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% block head_title %}{% trans "Confirm Email" %}{% endblock %}
{% block page_title %}{% trans "Confirm Email" %}{% endblock %}
{% block utility_body %}
<form method="post" action="{% url "account_confirm_email" key=confirmation.key %}">
<fieldset>
{% csrf_token %}
<p>{% blocktrans with email=confirmation.email_address.email %}Confirm email address <b>{{ email }}</b>?{% endblocktrans %}</p>
<button type="submit" class="btn btn-primary">{% trans "Confirm" %}</button>
</fieldset>
</form>
{% endblock %}

View file

@ -1,12 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% block head_title %}{% trans "Confirm your email address" %}{% endblock %}
{% block page_title %}{% trans "Confirm your email address" %}{% endblock %}
{% block utility_body %}
<p>{% blocktrans %}We have sent you an email to <b>{{ email }}</b> for verification. Follow the link provided to finalize the signup process. If you do not receive it within a few minutes, contact us at <a href="mailto:{{ THEME_CONTACT_EMAIL }}">{{ THEME_CONTACT_EMAIL }}</a>.{% endblocktrans %}</p>
<p><a href="{{ success_url }}">{% trans "Go back" %}</a></p>
{% endblock %}

View file

@ -1,10 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% block head_title %}{% trans "Email confirmed" %}{% endblock %}
{% block page_title %}{% trans "Email confirmed" %}{% endblock %}
{% block utility_body %}
<p>{% blocktrans with email=confirmation.email_address.email %}You have confirmed <b>{{ email }}</b>{% endblocktrans %}</p>
{% endblock %}

View file

@ -1,43 +0,0 @@
{% extends "utility_page.html" %}
{% load account_tags %}
{% load i18n %}
{% load bootstrap %}
{% block head_title %}{% trans "Log in" %}{% endblock %}
{% block page_title %}{% trans "Log in to an existing account" %}{% endblock %}
{% block utility_body %}
{% if ACCOUNT_OPEN_SIGNUP %}
<p class="login-signup">
{% trans "Don't have an account?" %} <strong><a href="{% urlnext 'account_signup' %}">{% trans "Sign up" %}</a></strong>
</p>
{% endif %}
<p>
{% trans "Accounts from previous years have not been carried over to this site." %}
{% trans "You will need to create a new account for this year's site." %}
</p>
<form method="POST" action="{% url "account_login" %}" autocapitalize="off" {% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
<fieldset>
{% include "_form_snippet.html" with form=form %}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button type="submit" class="btn btn-primary">{% trans "Log in" %}</button>
<a href="{% url "account_password_reset" %}" class="btn btn-link">{% trans "Forgot your password?" %}</a>
</fieldset>
</form>
{% endblock %}
{% block scripts %}
{{ block.super }}
<script type="text/javascript">
$(document).ready(function() {
$('#id_username').focus();
});
</script>
{% endblock %}

View file

@ -1,14 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% block head_title %}{% trans "Log out" %}{% endblock %}
{% block page_title %}{% trans "Log out" %}{% endblock %}
{% block utility_body %}
<form method="POST" action="{% url "account_logout" %}">
{% csrf_token %}
<p>{% trans "Are you sure you want to log out?" %}</p>
<button type="submit" class="btn btn-primary">{% trans "Log out" %}</button>
</form>
{% endblock %}

View file

@ -1,20 +0,0 @@
{% extends "account/base.html" %}
{% load i18n %}
{% load bootstrap %}
{% block body_class %}account account-password{% endblock %}
{% block head_title %}{% trans "Change password" %}{% endblock %}
{% block page_title %}{% trans "Change password" %}{% endblock %}
{% block btn-password %}btn__active{% endblock %}
{% block account_body %}
<form method="POST" action="">
<fieldset>
{% csrf_token %}
{% include "_form_snippet.html" with form=form %}
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
</fieldset>
</form>
{% endblock %}

View file

@ -1,30 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% load bootstrap %}
{% load account_tags %}
{% block head_title %}{% trans "Password reset" %}{% endblock %}
{% block page_title %}{% trans "Password reset" %}{% endblock %}
{% user_display request.user as user_display %}
{% block utility_body %}
<form method="POST" action="">
<p class="lead">{% trans "Forgotten your password? Enter your email address below, and we'll send you an email allowing you to reset it." %}</p>
<fieldset class="row">
{% csrf_token %}
{% include "_form_snippet.html" with form=form %}
<button type="submit" class="btn btn-primary">
{% trans "Reset my password" %}
</button>
</fieldset>
</form>
<p>{% blocktrans %}If you have any trouble resetting your password, contact us at <a href="mailto:{{ THEME_CONTACT_EMAIL }}">{{ THEME_CONTACT_EMAIL }}</a>.{% endblocktrans %}</p>
{% endblock %}
{% block extra_body %}
<script>
$("#id_email").focus();
</script>
{% endblock %}

View file

@ -1,23 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% load account_tags %}
{% block head_title %}{% trans "Password reset sent" %}{% endblock %}
{% block page_title %}{% trans "Password reset sent" %}{% endblock %}
{% block utility_body %}
{% if not resend %}
<p>{% blocktrans %}We have sent you an email. If you do not receive it within a few minutes, try resending or contact us at <a href="mailto:{{ THEME_CONTACT_EMAIL }}">{{ THEME_CONTACT_EMAIL }}</a>.{% endblocktrans %}</p>
<form method="POST" action="{% url "account_password_reset" %}">
{% csrf_token %}
{% for field in form %}
{{ field.as_hidden }}
{% endfor %}
<button type="submit" name="resend" class="btn btn-primary">{% trans "Resend" %}</button>
</form>
{% else %}
<p>{% blocktrans %}We have resent the password email. If you do not receive it within a few minutes, contact us at <a href="mailto:{{ THEME_CONTACT_EMAIL }}">{{ THEME_CONTACT_EMAIL }}</a>.{% endblocktrans %}</p>
{% endif %}
{% endblock %}

View file

@ -1,18 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% load bootstrap %}
{% block head_title %}{% trans "Set your new password" %}{% endblock %}
{% block page_title %}{% trans "Set your new password" %}{% endblock %}
{% block utility_body %}
<form method="POST" action="{% url "account_password_reset_token" uidb36=uidb36 token=token %}">
<legend>{% trans "Set your new password" %}</legend>
<fieldset>
{% csrf_token %}
{% include "_form_snippet.html" with form=form %}
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
</fieldset>
</form>
{% endblock %}

View file

@ -1,11 +0,0 @@
{% extends "utility_page.html" %}
{% load i18n %}
{% block head_title %}{% trans "Bad token" %}{% endblock %}
{% block page_title %}{% trans "Bad token" %}{% endblock %}
{% block utility_body %}
{% url "account_password_reset" as url %}
<p>{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ url }}">new password reset</a>.{% endblocktrans %}</p>
{% endblock %}

View file

@ -1,20 +0,0 @@
{% extends "account/base.html" %}
{% load i18n %}
{% load bootstrap %}
{% block body_class %}account account-settings{% endblock %}
{% block head_title %}{% trans "Account Settings" %}{% endblock %}
{% block page_title %}{% trans "Account Settings" %}{% endblock %}
{% block btn-settings %}btn__active{% endblock %}
{% block account_body %}
<form method="POST" action="{% url "account_settings" %}">
<fieldset>
{% csrf_token %}
{% include "_form_snippet.html" with form=form %}
<button class="btn btn-primary" type="submit">{% trans "Save" %}</button>
</fieldset>
</form>
{% endblock %}

View file

@ -1,33 +0,0 @@
{% extends "utility_page.html" %}
{% load account_tags %}
{% load i18n %}
{% load bootstrap %}
{% block head_title %}{% trans "Sign up" %}{% endblock %}
{% block page_title %}{% trans "Sign up" %}{% endblock %}
{% block utility_body %}
<p>
{% trans "Already have an account?" %} <strong><a href="{% urlnext 'account_login' %}">{% trans "Log in" %}</a></strong>
</p>
<form id="signup_form" method="post" action="{% url "account_signup" %}" autocapitalize="off" {% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
{% csrf_token %}
<fieldset>
{% include "_form_snippet.html" with form=form %}
</fieldset>
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button type="submit" class="btn btn-primary">{% trans "Sign up" %}</button>
</form>
{% endblock %}
{% block scripts %}
{{ block.super }}
<script type="text/javascript">
$(document).ready(function() {
$('#id_username').focus();
});
</script>
{% endblock %}

View file

@ -1,14 +0,0 @@
{% extends "site_base.html" %}
{% load i18n %}
{% block head_title %}{% trans "Sign up" %}{% endblock %}
{% block body %}
<h1>{% trans "This site is in private beta" %}</h1>
<p>{% blocktrans %}If you have signup code you can enter it below.{% endblocktrans %}</p>
<form method="get" action="">
<div><input type="text" name="code" placeholder="{% trans 'Your signup code...' %}" /></div>
<div><input type="submit" class="btn btn-primary"></div>
</form>
{% endblock %}

View file

@ -1,8 +1,6 @@
{% load account_tags %}
{% load i18n %}
{% user_display message.user as user %}
<p>
{% blocktrans with title=proposal.title %}<b>{{ user }}</b> has added a message on <b>{{ title }}</b>.{% endblocktrans %}
{% blocktrans with title=proposal.title user=message.user %}<b>{{ user }}</b> has added a message on <b>{{ title }}</b>.{% endblocktrans %}
</p>
<blockquote>
{{ message.message|safe }}

View file

@ -1 +1 @@
{% load account_tags i18n %}{% user_display message.user as user %}{% blocktrans with title=proposal.title %}New message on "{{ title }}" from {{ user }}{% endblocktrans %}
{% load i18n %}{% blocktrans with title=proposal.title user=message.user.username %}New message on "{{ title }}" from {{ user }}{% endblocktrans %}

View file

@ -1,8 +1,6 @@
{% load account_tags %}
{% load i18n %}
{% user_display user as username %}
<p>
{% blocktrans with title=proposal.title %}<b>{{ username }}</b> has made changes to <b>{{ title }}</b> which you have previously reviewed or commented on.{% endblocktrans %}
{% blocktrans with title=proposal.title username=user.username %}<b>{{ username }}</b> has made changes to <b>{{ title }}</b> which you have previously reviewed or commented on.{% endblocktrans %}
</p>
<p>
{% url 'review_detail' proposal.pk as detail_url %}

View file

@ -1 +1 @@
{% load account_tags i18n %}{% user_display user as username %}{% blocktrans with title=proposal.title %}"{{ title }}" has been updated by {{ username }}{% endblocktrans %}
{% load i18n %}{% blocktrans with title=proposal.title username=user.username %}"{{ title }}" has been updated by {{ username }}{% endblocktrans %}

View file

@ -1,6 +1,5 @@
{% load i18n account_tags %}
{% user_display user as username %}
{% blocktrans with team_name=team team_url=team.get_absolute_url site_name=current_site.name site_url=current_site %}
{% load i18n %}
{% blocktrans with team_name=team team_url=team.get_absolute_url site_name=current_site.name site_url=current_site username=user.username %}
<p>
User "{{ username }}" has applied to join <b>{{ team_name }}</b> on {{ site_name }}.
</p>

View file

@ -1 +1 @@
{% load i18n account_tags %}{% user_display user as username %}{% blocktrans %}{{ username}} has applied to to join "{{ team }}"{% endblocktrans %}
{% load i18n %}{% blocktrans with username=user.username %}{{ username }} has applied to to join "{{ team }}"{% endblocktrans %}

View file

@ -1,4 +1,4 @@
{% load i18n account_tags %}
{% load i18n %}
{% blocktrans with team_name=team team_url=team.get_absolute_url site_name=current_site.name site_url=current_site %}
<p>
@ -9,4 +9,4 @@
To accept this invitation, visit the following url:
<a href="http://{{ site_url }}{{ team_url }}">http://{{ site_url }}{{ team_url }}</a>
</p>
{% endblocktrans %}
{% endblocktrans %}

View file

@ -1,7 +1,6 @@
{% extends "symposion/proposals/base.html" %}
{% load i18n %}
{% load account_tags %}
{% load bootstrap %}
{% block head_title %}{{ proposal.title }}{% endblock %}
@ -65,7 +64,7 @@
{% for message in proposal.messages.all %}
<div class="review-box">
<div class="comment"><em>{{ message.message|safe }}</em></div>
<div class="dateline"><b>{% user_display message.user %}</b> {{ message.submitted_at|timesince }} ago</div>
<div class="dateline"><b>{{ message.user.username }}</b> {{ message.submitted_at|timesince }} ago</div>
</div>
<br />
{% endfor %}

View file

@ -2,7 +2,6 @@
{% load i18n %}
{% load bootstrap %}
{% load account_tags %}
{% block body %}
@ -137,7 +136,7 @@
{% if review.user.speaker_profile %}
{{ review.user.speaker_profile.name }}
{% else %}
{% user_display review.user %}
{{ review.user.username }}
{% endif %}
</b>
{{ review.submitted_at|timesince }} ago <br />
@ -153,7 +152,7 @@
{% for message in review_messages %}
<div class="comment-box">
<div class="commment-content">
<b>{% user_display message.user %}</b>
<b>{{ message.user.username }}</b>
{{ message.submitted_at|timesince }} ago <br />
{{ message.message|safe }}
</div>

View file

@ -14,8 +14,6 @@ import symposion.views
urlpatterns = [
url(r"^admin/", include(admin.site.urls)),
url(r"^account/", include("account.urls")),
url(r"^dashboard/", symposion.views.dashboard, name="dashboard"),
url(r"^speaker/", include("symposion.speakers.urls")),

View file

@ -1,7 +1,6 @@
# Should use latest 1.9 for security
Django==1.9.7
pinax-theme-bootstrap==7.3.0
django-user-accounts==1.3.1
metron==1.3.7
pinax-eventlog==1.1.1
django-formset-js==0.5.0
@ -19,6 +18,6 @@ mysqlclient>=1.3.3
django-nose==1.4.3
coverage==4.0.3
-e git+https://github.com/lca2017/symposion.git@lca2017#egg=symposion
-e git+https://gitlab.com/lca2018/symposion.git@lca2018#egg=symposion
-e git+https://github.com/chrisjrn/registrasion.git@master#egg=registrasion
-e git+https://github.com/chrisjrn/registrasion-stripe.git@master#egg=registrasion-stripe