Newer
Older
skyldap / autocomplete / password.py
@One One on 2 Apr 2022 475 bytes initial
import imp
import secrets
import string


class AutocompletePassword:
    def __init__(self, conf):
        self.config = {
            "charset": string.ascii_lowercase + string.digits,
            "length": 12
        }

        self.config.update(conf)

    def run(self, fields):
        autocomplete = {
            "userPassword": "".join(secrets.choice(self.config["charset"]) for _ in range(self.config["length"]))
        }
        return {**autocomplete, **fields}