def authenticate():
    error = {}

    username = local.request.form.get("username", u"")
    password = local.request.form.get("password", u"")
    
    if len(username) == 0 or len(password) == 0:
        error["length"] = "yes"
    
    if len(error) == 0:
        uid = user.authenticate(username, password)
        if uid is None:
            error["invalid"] = "yes"
    
    if len(error) == 0:
        local.session["uid"] = uid
        
        if not user.haschangedpasswd(uid):
            redirect("login.chpasswd_form")
            return

        redirect("index.index")
        return

    redirect(
        "login.form",
        **error
    )
Beispiel #2
0
def login_do():
    username = local.request.form.get("username")
    password = local.request.form.get("password")

    uid = user.authenticate(username, password)

    if uid == None:
        redirect("netlogon.login_form", error="")
        return

    local.response = werkzeug.utils.redirect("http://www.dikulan.dk/", 307)