Exemplo n.º 1
0
 def POST(self):
     data = web.input()
     del data['sub']
     del data['repasswd']
     user = User()
     user.create_user(data)
     raise web.seeother('/', False)
Exemplo n.º 2
0
    def POST(self):
        request_data = web.input()
        password=request_data['passwd']
        rpassword=request_data['rpasswd']
        if password != rpassword: 
            #如果passwd!=rpasswd
            error={'status':'failure','msg':"passwd is not equilt rpasswd"}
            return sher.main_render.register(error)

        user = User()
        row = user.getUserBy({'username':request_data['username'],'email':request_data['email']})
        if row:#如果用户名存在,提示更改用户名
            error={'status':'failure', 'msg':'user name existed'}
            return sher.main_render.register(error)

        createdata=int(time.time())#加入时间
        request_data['created']=createdata
        del request_data['rpasswd']#如果不存在当前用户,直接存储到数据库,回到login页面
        user.create_user(request_data)
        raise web.seeother('login',False)