Ejemplo n.º 1
0
Archivo: user.py Proyecto: bjornua/dna
def create_do():
    if not authcheck():
        return
    form = local.request.form
    username = form.get("username")
    email = form.get("email")
    macaddrs_max = form.get("macaddrs_max")
    password0 = form.get("password0")
    password1 = form.get("password1")
    
    errors = set()
    if password0 != password1:
        errors.add("passwordmatch")

    try:
        macaddrs_max = int(macaddrs_max)
    except ValueError:
        errors.add("macaddrs_max_type")
    else:
        if not macaddrs_max >= 0:
            errors.add("macaddrs_max_range")
    if len(errors) > 0:
        redirect("user.create_form", errors=",".join(errors), username=username, email=email, macaddrs_max=macaddrs_max)
        return
    
    user.create(username=username, email=email, macaddrs_max=macaddrs_max, password=password0)
    redirect("user.list")
Ejemplo n.º 2
0
    ("be23-3e16", ""),
    ("be7b-6ade", "*****@*****.**"),
    ("be8c-ee2c", "*****@*****.**"),
    ("c3fb-8df7", "*****@*****.**"),
    ("c83b-fff8", "*****@*****.**"),
    ("c9e2-8d1f", "*****@*****.**"),
    ("cf43-192c", "*****@*****.**"),
    ("d1ae-933a", ""),
    ("d5bb-af18", "*****@*****.**"),
    ("d6f4-853b", ""),
    ("d7e4-0509", "*****@*****.**"),
    ("d9a2-66d1", "*****@*****.**"),
    ("da35-2a46", "*****@*****.**"),
    ("df16-b62b", "*****@*****.**"),
    ("e406-91b5", "*****@*****.**"),
    ("e5e3-531e", "*****@*****.**"),
    ("ef70-9c02", "*****@*****.**"),
    ("ef9d-3dbc", "*****@*****.**"),
    ("efd9-c48d", "*****@*****.**"),
    ("f0d8-d857", "*****@*****.**"),
    ("f682-4b23", "*****@*****.**"),
    ("fb6c-eb70", "*****@*****.**"),
    ("fdc0-7177", "*****@*****.**"),
    ("feb0-7a42", "*****@*****.**"),
    ("f1f9-523f", "*****@*****.**"),
    ("ff24-d2e0", "*****@*****.**"),
)

for billetnr, email in users:
    user.create(username=billetnr, email=email, macaddrs_max=1)