Skip to content

Commit

Permalink
added password set template
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandravaphilips committed Oct 16, 2024
1 parent fd4fd82 commit 3a19af3
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
2 changes: 1 addition & 1 deletion peachjam/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 22 additions & 0 deletions peachjam/migrations/0167_peachjamsettings_allow_social_logins.py
Original file line number Diff line number Diff line change
@@ -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",
),
),
]
5 changes: 5 additions & 0 deletions peachjam/models/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
53 changes: 53 additions & 0 deletions peachjam/templates/account/password_set.html
Original file line number Diff line number Diff line change
@@ -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 %}
<form method="post" action="{% url 'account_set_password' %}">
{% csrf_token %}
<div class="row">
<div class="col-lg-6 mx-auto">
<div class="card">
<h5 class="card-header">{% trans 'Set password' %}</h5>
<div class="card-body">
<div class="mb-3">
<label for="{{ form.password1.id_for_label }}">{{ form.password1.label }}</label>
<input type="password"
class="form-control"
name="{{ form.password1.name }}"
id="{{ form.password1.id_for_label }}"
value="{{ form.password1.value|default:'' }}"
required/>
{% if form.password1.errors %}
<div class="text-danger">
{% for error in form.password1.errors %}<p>{{ error }}</p>{% endfor %}
</div>
{% endif %}
</div>
<div class="mb-3">
<label for="{{ form.password2.id_for_label }}">{{ form.password2.label }}</label>
<input type="password"
class="form-control"
name="{{ form.password2.name }}"
id="{{ form.password2.id_for_label }}"
value="{{ form.password2.value|default:'' }}"
required/>
{% if form.password2.errors %}
<div class="text-danger">
{% for error in form.password2.errors %}<p>{{ error }}</p>{% endfor %}
</div>
{% endif %}
</div>
</div>
<div class="card-footer text-end">
<button type="submit" class="btn btn-success" name="action">{% trans "Set password" %}</button>
</div>
</div>
</div>
</div>
</form>
{% endblock %}

0 comments on commit 3a19af3

Please sign in to comment.