mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
setting to enable signup
This commit is contained in:
parent
7fa87edda7
commit
34a15ff51f
@ -834,6 +834,12 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
|||||||
'default': True,
|
'default': True,
|
||||||
'validator': bool,
|
'validator': bool,
|
||||||
},
|
},
|
||||||
|
'LOGIN_ENABLE_REG': {
|
||||||
|
'name': _('Enable registration'),
|
||||||
|
'description': _('Enable self-registration for users on the login-pages'),
|
||||||
|
'default': False,
|
||||||
|
'validator': bool,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
{% settings_value 'LOGIN_ENABLE_REG' as enable_reg %}
|
||||||
{% settings_value 'LOGIN_ENABLE_PWD_FORGOT' as enable_pwd_forgot %}
|
{% settings_value 'LOGIN_ENABLE_PWD_FORGOT' as enable_pwd_forgot %}
|
||||||
|
|
||||||
<h1>{% trans "Sign In" %}</h1>
|
<h1>{% trans "Sign In" %}</h1>
|
||||||
|
|
||||||
|
{% if enable_reg %}
|
||||||
{% get_providers as socialaccount_providers %}
|
{% get_providers as socialaccount_providers %}
|
||||||
{% if socialaccount_providers %}
|
{% if socialaccount_providers %}
|
||||||
<p>{% blocktrans with site.name as site_name %}Please sign in with one
|
<p>{% blocktrans with site.name as site_name %}Please sign in with one
|
||||||
@ -19,6 +21,7 @@ for a account and sign in below:{% endblocktrans %}</p>
|
|||||||
<p>{% blocktrans %}If you have not created an account yet, then please
|
<p>{% blocktrans %}If you have not created an account yet, then please
|
||||||
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
|
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<form class="login" method="POST" action="{% url 'account_login' %}">
|
<form class="login" method="POST" action="{% url 'account_login' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
{% extends "account/base.html" %}
|
{% extends "account/base.html" %}
|
||||||
|
|
||||||
{% load i18n crispy_forms_tags %}
|
{% load i18n crispy_forms_tags inventree_extras %}
|
||||||
|
|
||||||
{% block head_title %}{% trans "Signup" %}{% endblock %}
|
{% block head_title %}{% trans "Signup" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% settings_value 'LOGIN_ENABLE_REG' as enable_reg %}
|
||||||
|
|
||||||
<h1>{% trans "Sign Up" %}</h1>
|
<h1>{% trans "Sign Up" %}</h1>
|
||||||
|
|
||||||
<p>{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</p>
|
<p>{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</p>
|
||||||
|
|
||||||
|
{% if enable_reg %}
|
||||||
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
|
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
@ -25,4 +28,10 @@
|
|||||||
</div>
|
</div>
|
||||||
{% include "socialaccount/snippets/login_extra.html" %}
|
{% include "socialaccount/snippets/login_extra.html" %}
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<div class='alert alert-block alert-danger'>
|
||||||
|
<p>{% trans "This function is currently disabled. Please contact an administrator." %}</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
Loading…
Reference in New Issue
Block a user