Example #1
0
def passwd_update(db, render):
    form = forms.passwd_update_form()
    if not form.validates(source=request.forms):
        return render("base_form", form=form)
    if form.d.operator_pass != form.d.operator_pass_chk:
        return render("base_form", form=form, msg=u"确认密码不一致")
    opr = db.query(models.SlcOperator).filter_by(operator_name=form.d.operator_name).first()
    opr.operator_pass = md5(form.d.operator_pass).hexdigest()

    ops_log = models.SlcRadOperateLog()
    ops_log.operator_name = get_cookie("username")
    ops_log.operate_ip = get_cookie("login_ip")
    ops_log.operate_time = utils.get_currtime()
    ops_log.operate_desc = u'操作员(%s)修改密码' % (get_cookie("username"),)
    db.add(ops_log)

    db.commit()
    redirect("/passwd")
Example #2
0
def passwd(db, render):
    form = forms.passwd_update_form()
    form.fill(operator_name=get_cookie("username"))
    return render("base_form", form=form)