mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-22 15:21:01 +00:00
Allow markdown on signup text
This commit is contained in:
parent
03929e12ea
commit
77ef358fef
3 changed files with 12 additions and 2 deletions
|
@ -7,7 +7,7 @@
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Create An Account</legend>
|
<legend>Create An Account</legend>
|
||||||
{% if config.signup_text %}{{ config.signup_text|safe|linebreaks }}{% endif %}
|
{% if signup_text %}{{ signup_text }}{% endif %}
|
||||||
{% if config.signup_allowed %}
|
{% if config.signup_allowed %}
|
||||||
{% for field in form %}
|
{% for field in form %}
|
||||||
{% include "forms/_field.html" %}
|
{% include "forms/_field.html" %}
|
||||||
|
|
|
@ -77,7 +77,7 @@ class BasicSettings(AdminSettingsPage):
|
||||||
},
|
},
|
||||||
"signup_text": {
|
"signup_text": {
|
||||||
"title": "Signup Page Text",
|
"title": "Signup Page Text",
|
||||||
"help_text": "Shown above the signup form",
|
"help_text": "Shown above the signup form.\nUse Markdown for formatting.",
|
||||||
"display": "textarea",
|
"display": "textarea",
|
||||||
},
|
},
|
||||||
"restricted_usernames": {
|
"restricted_usernames": {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
import markdown_it
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.forms import AuthenticationForm
|
from django.contrib.auth.forms import AuthenticationForm
|
||||||
from django.contrib.auth.password_validation import validate_password
|
from django.contrib.auth.password_validation import validate_password
|
||||||
from django.contrib.auth.views import LoginView, LogoutView
|
from django.contrib.auth.views import LoginView, LogoutView
|
||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404, render
|
||||||
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import FormView
|
from django.views.generic import FormView
|
||||||
|
|
||||||
|
@ -110,6 +112,14 @@ class Signup(FormView):
|
||||||
{"email": user.email},
|
{"email": user.email},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
if Config.system.signup_text:
|
||||||
|
context["signup_text"] = mark_safe(
|
||||||
|
markdown_it.MarkdownIt().render(Config.system.signup_text)
|
||||||
|
)
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class TriggerReset(FormView):
|
class TriggerReset(FormView):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue