From 3a19af3e47cd3f1dfc1b545618d6015449902692 Mon Sep 17 00:00:00 2001 From: Sandrava Date: Wed, 16 Oct 2024 14:28:32 +0100 Subject: [PATCH] added password set template --- peachjam/auth.py | 2 +- ...67_peachjamsettings_allow_social_logins.py | 22 ++++++++ peachjam/models/settings.py | 5 ++ peachjam/templates/account/password_set.html | 53 +++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 peachjam/migrations/0167_peachjamsettings_allow_social_logins.py create mode 100644 peachjam/templates/account/password_set.html diff --git a/peachjam/auth.py b/peachjam/auth.py index ddf5279c9..4ad099705 100644 --- a/peachjam/auth.py +++ b/peachjam/auth.py @@ -39,4 +39,4 @@ def pre_social_login(self, request, sociallogin): perform_login(request, user, email_verification="none") def is_open_for_signup(self, request, sociallogin): - return False + return pj_settings().allow_social_logins diff --git a/peachjam/migrations/0167_peachjamsettings_allow_social_logins.py b/peachjam/migrations/0167_peachjamsettings_allow_social_logins.py new file mode 100644 index 000000000..e7602f9b7 --- /dev/null +++ b/peachjam/migrations/0167_peachjamsettings_allow_social_logins.py @@ -0,0 +1,22 @@ +# Generated by Django 4.2.15 on 2024-10-16 13:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("peachjam", "0166_coredocument_ingestor"), + ] + + operations = [ + migrations.AddField( + model_name="peachjamsettings", + name="allow_social_logins", + field=models.BooleanField( + default=False, + help_text="Allow signups via social accounts", + verbose_name="allow social logins", + ), + ), + ] diff --git a/peachjam/models/settings.py b/peachjam/models/settings.py index c7b8b62de..523638bb3 100644 --- a/peachjam/models/settings.py +++ b/peachjam/models/settings.py @@ -67,6 +67,11 @@ class PeachJamSettings(SingletonModel): allowed_login_domains = models.CharField( verbose_name=_("allowed login domains"), max_length=1024, null=True, blank=True ) + allow_social_logins = models.BooleanField( + verbose_name=_("allow social logins"), + default=False, + help_text=_("Allow signups via social accounts"), + ) metabase_dashboard_link = models.URLField( verbose_name=_("metabase dashboard link"), null=True, blank=True diff --git a/peachjam/templates/account/password_set.html b/peachjam/templates/account/password_set.html new file mode 100644 index 000000000..d682afd69 --- /dev/null +++ b/peachjam/templates/account/password_set.html @@ -0,0 +1,53 @@ +{% extends "user_account/layout.html" %} +{% load i18n %} +{% block title %} + {% trans "Set Password" %} +{% endblock %} +{% block account-tabs %} + {% include 'user_account/_tabs.html' with active='password' %} +{% endblock %} +{% block account-content %} +
+ {% csrf_token %} +
+
+
+
{% trans 'Set password' %}
+
+
+ + + {% if form.password1.errors %} +
+ {% for error in form.password1.errors %}

{{ error }}

{% endfor %} +
+ {% endif %} +
+
+ + + {% if form.password2.errors %} +
+ {% for error in form.password2.errors %}

{{ error }}

{% endfor %} +
+ {% endif %} +
+
+ +
+
+
+
+{% endblock %}