Skip to content

Commit

Permalink
[#640] Restrict access to password-change from backend
Browse files Browse the repository at this point in the history
  • Loading branch information
vaszig committed May 27, 2022
1 parent 8b704fa commit 22473eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/open_inwoner/accounts/views/auth.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.contrib.auth.mixins import UserPassesTestMixin
from django.contrib.auth.views import (
PasswordChangeView,
PasswordResetConfirmView,
Expand All @@ -7,10 +8,14 @@

from open_inwoner.utils.views import LogMixin

from ..choices import LoginTypeChoices
from ..forms import CustomPasswordResetForm


class LogPasswordChangeView(LogMixin, PasswordChangeView):
class LogPasswordChangeView(UserPassesTestMixin, LogMixin, PasswordChangeView):
def test_func(self):
return self.request.user.login_type == LoginTypeChoices.default

def form_valid(self, form):
response = super().form_valid(form)

Expand Down

0 comments on commit 22473eb

Please sign in to comment.