Fix deprecation warnings

This commit is contained in:
Jan Dittberner 2023-02-18 19:07:33 +01:00
parent b3588b5e6c
commit 0f18e59d67
6 changed files with 67 additions and 75 deletions

View file

@ -3,22 +3,19 @@ This module defines the database models of operating system users.
"""
import base64
from datetime import date
import logging
import os
from datetime import date
from django.db import models, transaction
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models, transaction
from django.dispatch import Signal
from django.utils import timezone
from django.utils.translation import ugettext as _
from model_utils.models import TimeStampedModel
from passlib.hash import sha512_crypt
from passlib.utils import generate_password
from passlib.pwd import genword
_LOGGER = logging.getLogger(__name__)
@ -150,7 +147,7 @@ class UserManager(models.Manager):
If username is None the result of :py:meth:`get_next_username` is used.
If password is None a new password will be generated using passlib's
:py:func:`generate_password`.
:py:func:`genword`.
:param customer: Django User instance this user is associated to
:param str username: the username or None
@ -166,7 +163,7 @@ class UserManager(models.Manager):
if username is None:
username = self.get_next_username()
if password is None:
password = generate_password()
password = genword(entropy=128)
homedir = os.path.join(settings.OSUSER_HOME_BASEPATH, username)
group = Group.objects.create(groupname=username, gid=gid)
user = self.create(