Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hansegucker/AlekSIS-Core
  • pinguin/AlekSIS-Core
  • AlekSIS/official/AlekSIS-Core
  • sunweaver/AlekSIS-Core
  • sggua/AlekSIS-Core
  • edward/AlekSIS-Core
  • magicfelix/AlekSIS-Core
7 results
Show changes
Commits on Source (2)
......@@ -21,6 +21,7 @@ Added
* Allow configuring regex for allowed usernames
* [Dev] Support scheduled notifications.
* Implement StaticContentWidget
* Allow to enable password change independently of password reset
Changed
~~~~~~~
......
......@@ -271,6 +271,14 @@ class AllowPasswordChange(BooleanPreference):
verbose_name = _("Allow users to change their passwords")
@site_preferences_registry.register
class AllowPasswordReset(BooleanPreference):
section = auth
name = "allow_password_reset"
default = True
verbose_name = _("Allow users to reset their passwords")
@site_preferences_registry.register
class SignupEnabled(BooleanPreference):
section = auth
......
......@@ -95,7 +95,7 @@
{% trans "Login" %}
<i class="material-icons right">send</i>
</button>
{% if request.site.preferences.auth__allow_password_change and wizard.steps.current == "auth" %}
{% if request.site.preferences.auth__allow_password_reset and wizard.steps.current == "auth" %}
<a href="{% url "account_reset_password" %}" class="btn-flat right waves-effect waves-red">
{% trans "Reset password" %}
</a>
......
......@@ -30,6 +30,11 @@ urlpatterns = [
views.CustomPasswordChangeView.as_view(),
name="account_change_password",
),
path(
"accounts/password/reset/",
views.CustomPasswordResetView.as_view(),
name="account_reset_password",
),
path("accounts/", include("allauth.urls")),
path("invitations/send-invite", views.InvitePerson.as_view(), name="invite_person"),
path(
......
......@@ -36,7 +36,7 @@ from django.views.generic.list import ListView
import reversion
from allauth.account.utils import _has_verified_for_login, send_email_confirmation
from allauth.account.views import PasswordChangeView, SignupView
from allauth.account.views import PasswordChangeView, SignupView, PasswordResetView
from allauth.socialaccount.adapter import get_adapter
from allauth.socialaccount.models import SocialAccount
from celery_progress.views import get_progress
......@@ -1369,6 +1369,20 @@ class CustomPasswordChangeView(PermissionRequiredMixin, PasswordChangeView):
super().__init__(*args, **kwargs)
class CustomPasswordResetView(PermissionRequiredMixin, PasswordResetView):
"""Custom password reset view to allow to disable resetting of password."""
permission_required = "core.can_reset_password"
def __init__(self, *args, **kwargs):
if get_site_preferences()["auth__allow_password_reset"]:
self.template_name = "account/password_reset.html"
else:
self.template_name = "account/password_change_disabled.html"
super().__init__(*args, **kwargs)
class SocialAccountDeleteView(DeleteView):
"""Custom view to delete django-allauth social account."""
......