diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index aed6f2bf14..88377e0201 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -826,6 +826,14 @@ class InvenTreeSetting(BaseInvenTreeSetting): 'default': True, 'validator': bool, }, + + # login / SSO + 'LOGIN_ENABLE_PWD_FORGOT': { + 'name': _('Enable password forgot'), + 'description': _('Enable password forgot function on the login-pages'), + 'default': True, + 'validator': bool, + }, } class Meta: diff --git a/InvenTree/templates/InvenTree/settings/login.html b/InvenTree/templates/InvenTree/settings/login.html index 675787bfe9..b3758aadf6 100644 --- a/InvenTree/templates/InvenTree/settings/login.html +++ b/InvenTree/templates/InvenTree/settings/login.html @@ -14,7 +14,9 @@ {% include "InvenTree/settings/header.html" %} - + {% include "InvenTree/settings/setting.html" with key="LOGIN_ENABLE_REG" icon="fa-info-circle" %} + {% include "InvenTree/settings/setting.html" with key="LOGIN_ENABLE_SSO" icon="fa-info-circle" %} + {% include "InvenTree/settings/setting.html" with key="LOGIN_ENABLE_PWD_FORGOT" icon="fa-info-circle" %}
diff --git a/InvenTree/templates/account/login.html b/InvenTree/templates/account/login.html index 340098d7a1..f5cc64717f 100644 --- a/InvenTree/templates/account/login.html +++ b/InvenTree/templates/account/login.html @@ -1,11 +1,13 @@ {% extends "account/base.html" %} -{% load i18n account socialaccount crispy_forms_tags %} +{% load i18n account socialaccount crispy_forms_tags inventree_extras %} {% block head_title %}{% trans "Sign In" %}{% endblock %} {% block content %} +{% settings_value 'LOGIN_ENABLE_PWD_FORGOT' as enable_pwd_forgot %} +

{% trans "Sign In" %}

{% get_providers as socialaccount_providers %} @@ -27,7 +29,9 @@ for a account and sign in below:{% endblocktrans %}

+ {% if enable_pwd_forgot %} {% trans "Forgot Password?" %} + {% endif %}
diff --git a/InvenTree/templates/account/password_change.html b/InvenTree/templates/account/password_change.html index 22f34ab824..702094fcba 100644 --- a/InvenTree/templates/account/password_change.html +++ b/InvenTree/templates/account/password_change.html @@ -1,16 +1,21 @@ {% extends "account/base.html" %} -{% load i18n crispy_forms_tags %} +{% load i18n crispy_forms_tags inventree_extras %} {% block head_title %}{% trans "Change Password" %}{% endblock %} {% block content %} + +{% settings_value 'LOGIN_ENABLE_PWD_FORGOT' as enable_pwd_forgot %} +

{% trans "Change Password" %}

{% csrf_token %} {{ form|crispy }} + {% if enable_pwd_forgot %} {% trans "Forgot Password?" %} + {% endif %}
{% endblock %} diff --git a/InvenTree/templates/account/password_reset.html b/InvenTree/templates/account/password_reset.html index 7ed3a5c772..d28110b81c 100644 --- a/InvenTree/templates/account/password_reset.html +++ b/InvenTree/templates/account/password_reset.html @@ -1,16 +1,19 @@ {% extends "account/base.html" %} -{% load i18n account crispy_forms_tags %} +{% load i18n account crispy_forms_tags inventree_extras %} {% block head_title %}{% trans "Password Reset" %}{% endblock %} {% block content %} +{% settings_value 'LOGIN_ENABLE_PWD_FORGOT' as enable_pwd_forgot %} +

{% trans "Password Reset" %}

{% if user.is_authenticated %} {% include "account/snippets/already_logged_in.html" %} {% endif %} + {% if enable_pwd_forgot %}

{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

@@ -18,4 +21,9 @@ {{ form|crispy }}
+ {% else %} +
+

{% trans "This function is currently disabled. Please contact an administrator." %}

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