Add django-user-accounts app for use in place of SSO
This commit is contained in:
parent
ecfa3c1fce
commit
64b4d93470
6 changed files with 97 additions and 2 deletions
|
@ -3,7 +3,6 @@ AUTHENTICATION_BACKENDS = [
|
|||
'symposion.teams.backends.TeamPermissionsBackend',
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
]
|
||||
LOGIN_URL='/accounts/login'
|
||||
|
||||
ROOT_URLCONF = "pinaxcon.devmode_urls"
|
||||
|
||||
|
|
|
@ -170,6 +170,7 @@ TEMPLATES = [
|
|||
"django.template.context_processors.request",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"pinax_theme_bootstrap.context_processors.theme",
|
||||
"account.context_processors.account",
|
||||
"symposion.reviews.context_processors.reviews",
|
||||
"django_settings_export.settings_export",
|
||||
],
|
||||
|
@ -183,6 +184,8 @@ MIDDLEWARE = [
|
|||
"django.middleware.common.CommonMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"account.middleware.LocaleMiddleware",
|
||||
"account.middleware.TimezoneMiddleware",
|
||||
"djangosaml2.middleware.SamlSessionMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"debug_toolbar.middleware.DebugToolbarMiddleware",
|
||||
|
@ -267,6 +270,8 @@ INSTALLED_APPS = [
|
|||
"waffle",
|
||||
|
||||
"crispy_forms",
|
||||
|
||||
"account",
|
||||
]
|
||||
|
||||
CRISPY_TEMPLATE_PACK = "bootstrap4"
|
||||
|
@ -356,7 +361,7 @@ AUTHENTICATION_BACKENDS = [
|
|||
'djangosaml2.backends.Saml2Backend',
|
||||
]
|
||||
|
||||
LOGIN_URL = '/saml2/login/'
|
||||
LOGIN_URL = '/account/login/'
|
||||
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
|
||||
|
||||
CONFERENCE_ID = 2
|
||||
|
@ -582,3 +587,7 @@ VENUELESS_URL = os.environ.get('VENUELESS_URL', None)
|
|||
VENUELESS_AUDIENCE = os.environ.get('VENUELESS_AUDIENCE', "venueless")
|
||||
VENUELESS_TOKEN_ISSUER = os.environ.get('VENUELESS_TOKEN_ISSUER', "any")
|
||||
VENUELESS_SECRET = os.environ.get('VENUELESS_SECRET', SECRET_KEY)
|
||||
|
||||
|
||||
ACCOUNT_SIGNUP_REDIRECT_URL = '/dashboard/'
|
||||
ACCOUNT_LOGIN_REDIRECT_URL = '/dashboard/'
|
||||
|
|
43
pinaxcon/templates/account/login.html
Normal file
43
pinaxcon/templates/account/login.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
{% extends "site_base.html" %}
|
||||
|
||||
{% load account_tags %}
|
||||
{% load i18n %}
|
||||
{% load bootstrap %}
|
||||
|
||||
{% block head_title %}{% trans "Log in" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form method="POST" action="{% url "account_login" %}" autocapitalize="off" {% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
||||
<legend>{% trans "Log in to an existing account" %}</legend>
|
||||
{% csrf_token %}
|
||||
{{ form|bootstrap }}
|
||||
{% 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>
|
||||
</form>
|
||||
{% if ACCOUNT_OPEN_SIGNUP %}
|
||||
<p class="login-signup">
|
||||
<small>
|
||||
{% trans "Don't have an account?" %} <strong><a href="{% urlnext 'account_signup' %}">{% trans "Sign up" %}</a></strong>
|
||||
</small>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{% include "account/_login_sidebar.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
{{ block.super }}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#id_username').focus();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
41
pinaxcon/templates/account/signup.html
Normal file
41
pinaxcon/templates/account/signup.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
{% extends "site_base.html" %}
|
||||
{% load account_tags %}
|
||||
{% load i18n %}
|
||||
{% load bootstrap %}
|
||||
|
||||
{% block head_title %}Sign up{% endblock %}
|
||||
{% block page_title %}Sign up{% endblock %}
|
||||
|
||||
{% block alert %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form id="signup_form" method="post" action="{% url "account_signup" %}" autocapitalize="off" {% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
||||
{% csrf_token %}
|
||||
{{ form|bootstrap }}
|
||||
{% 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>
|
||||
<p class="login-signup">
|
||||
<small>
|
||||
{% trans "Already have an account?" %} <strong><a href="{% urlnext 'account_login' %}">{% trans "Log in" %}</a></strong>
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{% include "account/_signup_sidebar.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %} <!-- block content -->
|
||||
|
||||
{% block scripts_extra %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('#id_username').focus();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
|
@ -24,6 +24,8 @@ urlpatterns = [
|
|||
path("teams/", include("symposion.teams.urls")),
|
||||
path('raffle/', include("pinaxcon.raffle.urls")),
|
||||
|
||||
path("account/", include("account.urls")),
|
||||
|
||||
# Required by registrasion
|
||||
path('tickets/payments/', include('registripe.urls')),
|
||||
path('tickets/', include('registrasion.urls')),
|
||||
|
|
|
@ -50,3 +50,4 @@ django-sass-processor==0.8.2
|
|||
django-compressor==2.4
|
||||
|
||||
django-crispy-forms==1.9.2
|
||||
django-user-accounts==3.2.0
|
Loading…
Reference in a new issue