示例#1
0
def userchange():
    params = request.args if request.method == 'GET' else request.form
    id, username, password, age = params.get('id', ''), params.get(
        'username', ''), params.get('password', ''), params.get('age', '')
    Flag = user.ChangeUser(id, username, password, age)
    if Flag == 'sameusername':
        rt_list = user.GetUser(id)
        password = rt_list[2]
        return render_template('modifyuser.html',
                               id=id,
                               username=username,
                               password=password,
                               age=age,
                               msg=u'抱歉,用户%s已存在' % (username))
    elif Flag == 'samepassword':
        rt_list = user.GetUser(id)
        password = rt_list[2]
        return render_template('modifyuser.html',
                               id=id,
                               username=username,
                               password=password,
                               age=age,
                               msg=u'抱歉,用户%s修改后的密码不能和原密码相同' % (username))
    elif Flag:
        return redirect(
            url_for('users', color='green', Flag=u'恭喜,用户%s修改成功' % (username)))
    else:
        return render_template('modifyuser.html',
                               error=u'抱歉,用户%s修改失败' % (username))
示例#2
0
def userchange():
    params = request.args if request.method == 'GET' else request.form
    id,username,password,age,privilege=params.get('id',''),params.get('username',''),params.get('password',''),\
                             params.get('age',''),params.get('privilege','')
    Flag = user.ChangeUser(id, username, password, age, privilege)
    if Flag == 'sameusername':
        # rt_list=user.GetUser(id)
        # password=rt_list[2]
        return render_template('modifyuser.html',username=session.get('username',''),\
                               privilege=session.get('privilege',''),modifyid=id,modifyusername=username,\
                               modifypassword=password,modifyage=age,modifyprivilege=privilege,\
                               msg=u'抱歉,用户%s已存在' %(username),pageheader=u'修改用户信息')
    elif Flag == 'samepassword':
        rt_list = user.GetUser(id)
        password = rt_list[2]
        return render_template('modifyuser.html',username=session.get('username',''),\
                               privilege=session.get('privilege',''),modifyid=id,modifyusername=username,\
                               modifypassword=password,modifyage=age,modifyprivilege=privilege,\
                               msg=u'抱歉,用户%s修改后的密码不能和原密码相同' %(username),\
                               pageheader=u'修改用户信息')
    elif Flag:
        return redirect(
            url_for('users',
                    color='alert-success',
                    Flag=u'恭喜,用户%s修改成功' % (username)))
    else:
        return render_template('modifyuser.html',username=session.get('username',''),\
                               privilege=session.get('privilege',''),modifyid=id,modifyusername=username,\
                               modifypassword=password,modifyage=age,modifyprivilege=privilege,\
                               msg=u'抱歉,用户%s修改失败' %(username),\
                               pageheader=u'修改用户信息')
示例#3
0
def usermodify():
    id = request.args.get('id', '')
    rt_list = user.GetUser(id)
    if rt_list:
        id, username, password, age, privilege = rt_list
        return render_template('modifyuser.html',username=session.get('username',''),\
                               privilege=session.get('privilege',''),modifyid=id,modifyusername=username,\
                               modifypassword=password,modifyage=age,modifyprivilege=privilege,\
                               pageheader=u'修改用户信息')
    else:
        return 'Error'
示例#4
0
def userdel():
    id = request.args.get('id', '')
    rt_list = user.GetUser(id)
    username = rt_list[1]
    Flag = user.DelUser(id)
    if Flag:
        return redirect(
            url_for('users', color='green', Flag=u'恭喜,用户%s删除成功' % (username)))
    else:
        return redirect(
            url_for('users', color='red', Flag=u'抱歉,用户%s删除失败' % (username)))
示例#5
0
def usermodify():
    id = request.args.get('id', '')
    rt_list = user.GetUser(id)
    if rt_list:
        id, username, password, age = rt_list
        return render_template('modifyuser.html',
                               id=id,
                               username=username,
                               password=password,
                               age=age)
    else:
        return 'Error'