Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dojo/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def _wrapped(request, *args, **kw):
if username:
dojo_user = Dojo_User.objects.filter(username=username).first()
if dojo_user:
Dojo_User.enable_force_password_reset(dojo_user)
dojo_user.enable_force_password_reset()
raise Ratelimited
return fn(request, *args, **kw)
return _wrapped
Expand Down
1 change: 1 addition & 0 deletions dojo/importers/base_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Parser:
and is purely for the sake of type hinting
"""

@staticmethod
def get_findings(scan_type: str, test: Test) -> list[Finding]:
"""
Stub function to make the hinting happier. The actual class
Expand Down
2 changes: 2 additions & 0 deletions dojo/importers/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ def log_translation(
for field in self.field_names:
logger.debug(f"{field}: {getattr(self, field)}")

@staticmethod
def _compress_decorator(function):
@wraps(function)
def inner_compress_function(*args, **kwargs):
args[0].compress_options()
return function(*args, **kwargs)
return inner_compress_function

@staticmethod
def _decompress_decorator(function):
@wraps(function)
def inner_decompress_function(*args, **kwargs):
Expand Down
18 changes: 9 additions & 9 deletions dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,15 +231,15 @@ def wants_block_execution(user):
def force_password_reset(user):
return hasattr(user, "usercontactinfo") and user.usercontactinfo.force_password_reset

def disable_force_password_reset(user):
if hasattr(user, "usercontactinfo"):
user.usercontactinfo.force_password_reset = False
user.usercontactinfo.save()

def enable_force_password_reset(user):
if hasattr(user, "usercontactinfo"):
user.usercontactinfo.force_password_reset = True
user.usercontactinfo.save()
def disable_force_password_reset(self):
if hasattr(self, "usercontactinfo"):
self.usercontactinfo.force_password_reset = False
self.usercontactinfo.save()

def enable_force_password_reset(self):
if hasattr(self, "usercontactinfo"):
self.usercontactinfo.force_password_reset = True
self.usercontactinfo.save()

@staticmethod
def generate_full_name(user):
Expand Down
2 changes: 1 addition & 1 deletion dojo/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def change_password(request):
new_password = form.cleaned_data["new_password"]

user.set_password(new_password)
Dojo_User.disable_force_password_reset(user)
user.disable_force_password_reset()
user.save()

messages.add_message(request,
Expand Down
2 changes: 1 addition & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ select = [
"C90",
"NPY",
"PD",
"N803", "N804", "N811", "N812", "N813", "N814", "N817", "N818", "N999",
"N803", "N804", "N805", "N811", "N812", "N813", "N814", "N817", "N818", "N999",
"PERF1", "PERF2", "PERF401", "PERF403",
"E",
"W",
Expand Down