def create_admin(): from model.admin import admin_field admin = {} admin['account'] = 'admin' admin['password'] = md5('admin') print admin save_admin(admin)
def do_add(): '''保存用户信息''' from model import manager_props member = find_member({'account': request.forms.get('account')}) or {} for prop in manager_props: if prop in request.forms: member[prop] = request.forms.get(prop) #hash password if request.forms.get('password'): member['password'] = md5(request.forms.get('password')) save_member(member) redirect('/manage/super/list')
def do_login(): '''后台管理登陆逻辑''' account = request.forms.get('username') password = request.forms.get('password') remmeber_me(account) check_account(account, password) manager = find_manager({"account":account, "password":md5(password)}) if not manager: redirect('/system/login') set_session('account', account) redirect('/system/dashboard')
def do_login(): """后台管理登陆逻辑""" account = request.forms.get("username") password = request.forms.get("password") remmeber_me(account) check_account(account, password) manager = find_manager({"account": account, "password": md5(password)}) if not manager: redirect("/manage/login") set_session("account", account) redirect("/manage/dashboard")
def do_login(): '''后台管理登陆逻辑''' account = request.forms.get('username') password = request.forms.get('password') remmeber_me(account) check_account(account, password) manager = find_manager({"account": account, "password": md5(password)}) if not manager: redirect('/manage/login') set_session('account', account) redirect('/manage/dashboard')
def do_add(): '''保存用户信息''' if request.forms.get('_id'): _id = "%s" % request.forms.get('_id') member = find_one({'_id':_id}) or {} member = {} from model.admin import admin_field as fields for p in fields: if p in request.forms and p !='password': member[p] = request.forms.get(p) #hash password if request.forms.get('password'): member['password'] = md5(request.forms.get('password')) save(member) redirect('/system/manager/list')