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))
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'修改用户信息')
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'
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)))
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'