Changeset - 64b4d93470bd
[Not reviewed]
0 4 2
Ben Sturmfels (bsturmfels) - 14 months ago 2023-04-19 14:00:00
ben@sturm.com.au
Add django-user-accounts app for use in place of SSO
6 files changed with 97 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pinaxcon/devmode_settings.py
Show inline comments
...
 
@@ -5,3 +5,2 @@ AUTHENTICATION_BACKENDS = [
 
]
 
LOGIN_URL='/accounts/login'
 

	
pinaxcon/settings.py
Show inline comments
...
 
@@ -172,2 +172,3 @@ TEMPLATES = [
 
                "pinax_theme_bootstrap.context_processors.theme",
 
                "account.context_processors.account",
 
                "symposion.reviews.context_processors.reviews",
...
 
@@ -185,2 +186,4 @@ MIDDLEWARE = [
 
    "django.contrib.auth.middleware.AuthenticationMiddleware",
 
    "account.middleware.LocaleMiddleware",
 
    "account.middleware.TimezoneMiddleware",
 
    "djangosaml2.middleware.SamlSessionMiddleware",
...
 
@@ -269,2 +272,4 @@ INSTALLED_APPS = [
 
    "crispy_forms",
 

	
 
    "account",
 
]
...
 
@@ -358,3 +363,3 @@ AUTHENTICATION_BACKENDS = [
 

	
 
LOGIN_URL = '/saml2/login/'
 
LOGIN_URL = '/account/login/'
 
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
...
 
@@ -584 +589,5 @@ 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/'
pinaxcon/templates/account/login.html
Show inline comments
 
new file 100644
 
{% 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 %}
pinaxcon/templates/account/signup.html
Show inline comments
 
new file 100644
 
{% 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 %}
pinaxcon/urls.py
Show inline comments
...
 
@@ -26,2 +26,4 @@ urlpatterns = [
 

	
 
    path("account/", include("account.urls")),
 

	
 
    # Required by registrasion
requirements.txt
Show inline comments
...
 
@@ -52 +52,2 @@ django-compressor==2.4
 
django-crispy-forms==1.9.2
 
django-user-accounts==3.2.0
...
 
\ No newline at end of file
0 comments (0 inline, 0 general)