Use sha512_crypt from passlib.handlers.sha2_crypt

This commit is contained in:
Jan Dittberner 2023-02-19 13:47:08 +01:00
parent 610f8976fc
commit a8392ef91e
3 changed files with 4 additions and 12 deletions

View file

@ -14,7 +14,7 @@ from django.dispatch import Signal
from django.utils import timezone
from django.utils.translation import gettext as _
from model_utils.models import TimeStampedModel
from passlib.hash import sha512_crypt
from passlib.handlers.sha2_crypt import sha512_crypt
from passlib.pwd import genword
_LOGGER = logging.getLogger(__name__)
@ -175,8 +175,7 @@ class UserManager(models.Manager):
shell=settings.OSUSER_DEFAULT_SHELL,
)
user.set_password(password)
if commit:
user.save()
user.save()
return user

View file

@ -3,7 +3,7 @@ This module contains the signal handlers of the :py:mod:`osusers` app.
The module starts Celery_ tasks.
.. _Celery: http://www.celeryproject.org/
.. _Celery: https://www.celeryproject.org/
"""
from __future__ import absolute_import
@ -256,13 +256,6 @@ def handle_ssh_keys_changed(sender, instance, **kwargs):
_LOGGER.info("Change of SSH keys has been requested in task %s", taskresult.task_id)
# @receiver(post_delete)
# def handle_post_delete(sender, **kwargs):
# _LOGGER.debug(
# 'handling post_delete signal for %s with args %s',
# sender, kwargs)
@receiver(post_delete, sender=Group)
def handle_group_deleted(sender, instance, **kwargs):
"""

View file

@ -7,7 +7,7 @@ from django.core.exceptions import ValidationError
from django.test import TestCase
from django.test.utils import override_settings
from django.utils import timezone
from passlib.hash import sha512_crypt
from passlib.handlers.sha2_crypt import sha512_crypt
from osusers.models import (
CANNOT_USE_PRIMARY_GROUP_AS_ADDITIONAL,