default password implementation

This commit is contained in:
Jakob Ketterl 2021-02-06 18:22:13 +01:00
parent 1d9ab1494f
commit f6f01ebee5
2 changed files with 5 additions and 2 deletions

View File

@ -48,6 +48,9 @@ class CleartextPassword(Password):
} }
DefaultPasswordClass = CleartextPassword
class User(object): class User(object):
def __init__(self, name: str, enabled: bool, password: Password): def __init__(self, name: str, enabled: bool, password: Password):
self.name = name self.name = name

View File

@ -1,6 +1,6 @@
from abc import ABC, ABCMeta, abstractmethod from abc import ABC, ABCMeta, abstractmethod
from getpass import getpass from getpass import getpass
from owrx.users import UserList, User, CleartextPassword from owrx.users import UserList, User, DefaultPasswordClass
import sys import sys
import random import random
import string import string
@ -44,7 +44,7 @@ class NewUser(UserCommand):
print("Creating user {username}...".format(username=username)) print("Creating user {username}...".format(username=username))
userList = UserList() userList = UserList()
user = User(name=username, enabled=True, password=CleartextPassword(password)) user = User(name=username, enabled=True, password=DefaultPasswordClass(password))
userList.addUser(user) userList.addUser(user)
def getRandomPassword(self, length=10): def getRandomPassword(self, length=10):