core: remove some more dead code, add more help texts for factors
This commit is contained in:
parent
53e5cf7826
commit
81b66ecdcd
|
@ -8,7 +8,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<title>{% block title %}{% title %}{% endblock %}</title>
|
<title>{% block title %}{% trans title %}{% endblock %}</title>
|
||||||
<link rel="icon" type="image/png" href="{% static 'passbook/logo.png' %}">
|
<link rel="icon" type="image/png" href="{% static 'passbook/logo.png' %}">
|
||||||
<link rel="shortcut icon" type="image/png" href="{% static 'passbook/logo.png' %}">
|
<link rel="shortcut icon" type="image/png" href="{% static 'passbook/logo.png' %}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'node_modules/@patternfly/patternfly/patternfly.css' %}">
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% config 'passbook.branding' as branding %}
|
|
||||||
<!-- HERO -->
|
<!-- HERO -->
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="#7c72dc" align="center" style="padding: 0px 10px 0px 10px;">
|
<td bgcolor="#7c72dc" align="center" style="padding: 0px 10px 0px 10px;">
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{% config passbook.branding %}</title>
|
<title>passbook</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
<!-- ADDRESS -->
|
<!-- ADDRESS -->
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor="#1b2a32" align="left" style="padding: 0px 30px 30px 30px; color: #E9ECEF; font-family: 'Metropolis', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;">
|
<td bgcolor="#1b2a32" align="left" style="padding: 0px 30px 30px 30px; color: #E9ECEF; font-family: 'Metropolis', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 18px;">
|
||||||
<p style="margin: 0;"><a href="{% config 'passbook.branding' %}">{% config 'passbook.branding' %}</a></p>
|
<p style="margin: 0;"><a href="passbook">passbook</a></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% load utils %}
|
{% load utils %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% title title %}
|
{% trans title %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block head %}
|
{% block head %}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from captcha.fields import ReCaptchaField
|
from captcha.fields import ReCaptchaField
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from passbook.factors.captcha.models import CaptchaFactor
|
from passbook.factors.captcha.models import CaptchaFactor
|
||||||
from passbook.factors.forms import GENERAL_FIELDS
|
from passbook.factors.forms import GENERAL_FIELDS
|
||||||
|
@ -28,3 +28,8 @@ class CaptchaFactorForm(forms.ModelForm):
|
||||||
"public_key": forms.TextInput(),
|
"public_key": forms.TextInput(),
|
||||||
"private_key": forms.TextInput(),
|
"private_key": forms.TextInput(),
|
||||||
}
|
}
|
||||||
|
help_texts = {
|
||||||
|
"policies": _(
|
||||||
|
"Policies which determine if this factor applies to the current user."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""passbook administration forms"""
|
"""passbook administration forms"""
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from passbook.factors.email.models import EmailFactor
|
from passbook.factors.email.models import EmailFactor
|
||||||
from passbook.factors.forms import GENERAL_FIELDS
|
from passbook.factors.forms import GENERAL_FIELDS
|
||||||
|
@ -41,3 +41,8 @@ class EmailFactorForm(forms.ModelForm):
|
||||||
"ssl_keyfile": _("SSL Keyfile (optional)"),
|
"ssl_keyfile": _("SSL Keyfile (optional)"),
|
||||||
"ssl_certfile": _("SSL Certfile (optional)"),
|
"ssl_certfile": _("SSL Certfile (optional)"),
|
||||||
}
|
}
|
||||||
|
help_texts = {
|
||||||
|
"policies": _(
|
||||||
|
"Policies which determine if this factor applies to the current user."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ from django import forms
|
||||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django_otp.models import Device
|
from django_otp.models import Device
|
||||||
|
|
||||||
from passbook.factors.forms import GENERAL_FIELDS
|
from passbook.factors.forms import GENERAL_FIELDS
|
||||||
|
@ -80,3 +80,8 @@ class OTPFactorForm(forms.ModelForm):
|
||||||
"order": forms.NumberInput(),
|
"order": forms.NumberInput(),
|
||||||
"policies": FilteredSelectMultiple(_("policies"), False),
|
"policies": FilteredSelectMultiple(_("policies"), False),
|
||||||
}
|
}
|
||||||
|
help_texts = {
|
||||||
|
"policies": _(
|
||||||
|
"Policies which determine if this factor applies to the current user."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from passbook.factors.forms import GENERAL_FIELDS
|
from passbook.factors.forms import GENERAL_FIELDS
|
||||||
from passbook.factors.password.models import PasswordFactor
|
from passbook.factors.password.models import PasswordFactor
|
||||||
|
@ -49,3 +49,8 @@ class PasswordFactorForm(forms.ModelForm):
|
||||||
"password_policies": FilteredSelectMultiple(_("password policies"), False),
|
"password_policies": FilteredSelectMultiple(_("password policies"), False),
|
||||||
"reset_factors": FilteredSelectMultiple(_("reset factors"), False),
|
"reset_factors": FilteredSelectMultiple(_("reset factors"), False),
|
||||||
}
|
}
|
||||||
|
help_texts = {
|
||||||
|
"policies": _(
|
||||||
|
"Policies which determine if this factor applies to the current user."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
@ -25,18 +25,6 @@ passbook:
|
||||||
password_reset:
|
password_reset:
|
||||||
# Enable password reset, passwords are reset in internal Database and in LDAP if ldap.reset_password is true
|
# Enable password reset, passwords are reset in internal Database and in LDAP if ldap.reset_password is true
|
||||||
enabled: true
|
enabled: true
|
||||||
# Verification the user has to provide in order to be able to reset passwords. Can be any combination of `email`, `2fa`, `security_questions`
|
|
||||||
verification:
|
|
||||||
- email
|
|
||||||
# Text used in title, on login page and multiple other places
|
|
||||||
branding: passbook
|
|
||||||
login:
|
|
||||||
# Override URL used for logo
|
|
||||||
logo_url: null
|
|
||||||
# Override URL used for Background on Login page
|
|
||||||
bg_url: null
|
|
||||||
# Optionally add a subtext, placed below logo on the login page
|
|
||||||
subtext: null
|
|
||||||
footer:
|
footer:
|
||||||
links:
|
links:
|
||||||
# Optionally add links to the footer on the login page
|
# Optionally add links to the footer on the login page
|
||||||
|
@ -46,14 +34,3 @@ passbook:
|
||||||
uid_fields:
|
uid_fields:
|
||||||
- username
|
- username
|
||||||
- email
|
- email
|
||||||
# Provider-specific settings
|
|
||||||
ldap:
|
|
||||||
# Which field from `uid_fields` maps to which LDAP Attribute
|
|
||||||
login_field_map:
|
|
||||||
username: sAMAccountName
|
|
||||||
email: mail # or userPrincipalName
|
|
||||||
user_attribute_map:
|
|
||||||
active_directory:
|
|
||||||
username: "%(sAMAccountName)s"
|
|
||||||
email: "%(mail)s"
|
|
||||||
name: "%(displayName)"
|
|
||||||
|
|
|
@ -3,11 +3,9 @@ from hashlib import md5
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.apps import apps
|
|
||||||
from django.db.models import Model
|
from django.db.models import Model
|
||||||
from django.template import Context
|
from django.template import Context
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.translation import ugettext as _
|
|
||||||
|
|
||||||
from passbook.lib.config import CONFIG
|
from passbook.lib.config import CONFIG
|
||||||
from passbook.lib.utils.urls import is_url_absolute
|
from passbook.lib.utils.urls import is_url_absolute
|
||||||
|
@ -40,38 +38,6 @@ def fieldtype(field):
|
||||||
return field.__class__.__name__
|
return field.__class__.__name__
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=True)
|
|
||||||
def title(context: Context, *title) -> str:
|
|
||||||
"""Return either just branding or title - branding"""
|
|
||||||
branding = CONFIG.y("passbook.branding", "passbook")
|
|
||||||
if not title:
|
|
||||||
return branding
|
|
||||||
if "request" not in context:
|
|
||||||
return ""
|
|
||||||
resolver_match = context.request.resolver_match
|
|
||||||
if not resolver_match:
|
|
||||||
return ""
|
|
||||||
# Include App Title in title
|
|
||||||
app = ""
|
|
||||||
if resolver_match.namespace != "":
|
|
||||||
dj_app = None
|
|
||||||
namespace = context.request.resolver_match.namespace.split(":")[0]
|
|
||||||
# New label (App URL Namespace == App Label)
|
|
||||||
dj_app = apps.get_app_config(namespace)
|
|
||||||
title_modifier = getattr(dj_app, "title_modifier", None)
|
|
||||||
if title_modifier:
|
|
||||||
app_title = dj_app.title_modifier(context.request)
|
|
||||||
app = app_title + " -"
|
|
||||||
return _(
|
|
||||||
"%(title)s - %(app)s %(branding)s"
|
|
||||||
% {
|
|
||||||
"title": " - ".join([str(x) for x in title]),
|
|
||||||
"branding": branding,
|
|
||||||
"app": app,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def config(path, default=""):
|
def config(path, default=""):
|
||||||
"""Get a setting from the database. Returns default is setting doesn't exist."""
|
"""Get a setting from the database. Returns default is setting doesn't exist."""
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block card_title %}
|
{% block card_title %}
|
||||||
{% title 'Authorize Application' %}
|
{% trans 'Authorize Application' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block card %}
|
{% block card %}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% title 'Authorize Application' %}
|
{% trans 'Authorize Application' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block card %}
|
{% block card %}
|
||||||
|
|
Reference in New Issue