Skip to content
Snippets Groups Projects
Commit 62a075ea authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch '354-change-password' into '331-user-registration'

Resolve "Change password"

See merge request !474
parents 1af84364 38ec95c3
No related branches found
No related tags found
2 merge requests!474Resolve "Change password",!413Resolve "User registration"
Pipeline #5784 passed
......@@ -63,6 +63,18 @@ MENUS = {
"icon": "phonelink_lock",
"validators": ["menu_generator.validators.is_authenticated",],
},
{
"name": _("Change password"),
"url": "account_change_password",
"icon": "password",
"validators": [
"menu_generator.validators.is_authenticated",
(
"aleksis.core.util.predicates.permission_validator",
"core.can_change_password",
),
],
},
{
"name": _("Me"),
"url": "person",
......
......@@ -211,6 +211,14 @@ class SchoolNameOfficial(StringPreference):
verbose_name = _("Official name of the school, e.g. as given by supervisory authority")
@site_preferences_registry.register
class AllowPasswordChange(BooleanPreference):
section = auth
name = "allow_password_change"
default = True
verbose_name = _("Allow users to change their passwords")
@site_preferences_registry.register
class SignupEnabled(BooleanPreference):
section = auth
......
......@@ -318,6 +318,9 @@ rules.add_perm("core.edit_default_dashboard", edit_default_dashboard_predicate)
can_register_predicate = is_site_preference_set(section="auth", pref="signup_enabled")
rules.add_perm("core.can_register", can_register_predicate)
can_change_password_predicate = is_site_preference_set(section="auth", pref="allow_password_change")
rules.add_perm("core.can_change_password", can_change_password_predicate)
# Upload and browse files via CKEditor
upload_files_ckeditor_predicate = has_person & has_global_perm("core.upload_files_ckeditor")
rules.add_perm("core.upload_files_ckeditor", upload_files_ckeditor_predicate)
{% extends "core/base.html" %}
{% load i18n materia_form %}
{% load i18n material_form %}
{% block browser_title %}{% trans "Change password" %}{% endblock %}
{% block page_title %}{% trans "Change password" %}{% endblock %}
......@@ -9,7 +9,7 @@
<div class="alert warning">
<p>
<i class="material-icons left">warning</i>
{% blocktrans %}Forgot your current password? Click here to reset it: <a href="{% url 'account_reset_password' %}">"Forgot Password?</a></a>.{% endblocktrans %}
{% trans "Forgot your current password? Click here to reset it:" %} <a href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a></a>.
</p>
</div>
......@@ -17,7 +17,7 @@
{% csrf_token %}
{% form form=form %}{% endform %}
{% trans "Change password" as caption %}
{% include "core/partials/save_button.html" with caption=caption icon="priotity_high" %}
{% include "core/partials/save_button.html" with caption=caption icon="priority_high" %}
</form>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment