def POST(self): email=web.input().get("email") name=web.input().get("nickname") passwd=web.input().get("password") if not( email and name and passwd): content= u"输入不能为空" return render.signup(is_login=False,content=content) if User.objects(email=email).first() : content= u"邮箱已经注册" return render.signup(is_login=False,content=content) if User.objects(username=name).first() : content =u"用户名已经被注册" return render.signup(is_login=False,content=content) ID=User.objects.count() + 101 user = User(username=name,email=email,password=passwd,ID=User.objects.count() + 101) user.avatar="default.png" user.avatar_big="default_big.png" #方便管理,只有一级目录 user.save() if user : Auth.set_login(user.id,name.encode("utf-8")) return web.seeother("/") else: content =u"用户名已经被注册" return render.signup(is_login=False,content=content)
def GET(self): return render.signup(is_login=Auth.is_login(),content=None)