This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
u-auth/uauth/organization/utils.py

21 lines
485 B
Python

import random
from django.contrib.auth.hashers import make_password
from .models import LocalAccount
def create_password():
return ''.join([random.choice('23456789ABCDEFGHJLMNPQRSTUVWXZabcdefghjkmnpqrstuvwxyz')
for x in range(random.randint(6,9))])
def create_user(data):
if not data['password']:
data['password'] = create_password()
try:
user = LocalAccount.objects.create(**data)
return user
except:
return False