Skip to content
Snippets Groups Projects
Commit c2fbe569 authored by Tom Teichler's avatar Tom Teichler :beers: Committed by root
Browse files

Allow users to change their password. Closes #354

parent dd3aa077
No related branches found
No related tags found
2 merge requests!474Resolve "Change password",!413Resolve "User registration"
Pipeline #5738 failed
......@@ -63,6 +63,12 @@ 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",
......
......@@ -208,6 +208,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,15 +9,15 @@
<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>
<form method="post" action="{% url 'account_change_password' %}">
{% csrf_token %}
{% form form=form %}
{% 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