def post(self): name = self.get_argument('signupName') pwd = self.get_argument('password') pwdC = self.get_argument('pwdConfirm') id = self.get_argument('id') ugroup = self.get_argument('ug') email = self.get_argument('email') if pwd != pwdC: # 判断两次输入的密码不相同时候 self.render('error.html', title=None, content='两次输入的密码不同<br>请重新注册', icon='ion-alert-circled', active='none', id=None) else: if ugroup == 'teacher': ugroup = 't' elif ugroup == 'student': ugroup = 's' try: if getStudent(id) is None and getTeacher(id) is None: # 账户不存在' if not getATempUser(id): # 在临时表中没有记录 insertIntoTempUser(id, ugroup, name, pwd, email) self.render('error.html', title='申请成功', content='请等待管理员通过你的申请吧', icon='ion-checkmark-circled', active='none', id=None) else: # 这个账户已经申请过,在临时表里有记录 self.render('error.html', title=None, content='请等待管理员通过你的申请吧', icon='ion-alert-circled', active='none', id=None) else: # 账户已经存在, 一个账户只能存在于一个用户组里 self.render('error.html', title=None, content='这个号码已经被注册过了', icon='ion-alert-circled', active='none', id=None) except Exception as e: print("Error!", e) self.render('error.html', title='申请失败', content='出错啦,请重新申请新用户', icon='ion-alert-circled', active='none', id=None)
def post(self): name = self.get_argument("signupName") pwd = self.get_argument("password") pwdC = self.get_argument("pwdConfirm") id = self.get_argument("id") ugroup = self.get_argument("ug") email = self.get_argument("email") if pwd != pwdC: # 判断两次输入的密码不相同时候 self.render( "error.html", title=None, content="两次输入的密码不同<br>请重新注册", icon="ion-alert-circled", active="none", id=None ) else: if ugroup == "teacher": ugroup = "t" elif ugroup == "student": ugroup = "s" try: if getStudent(id) is None and getTeacher(id) is None: # 账户不存在' if not getATempUser(id): # 在临时表中没有记录 insertIntoTempUser(id, ugroup, name, pwd, email) self.render( "error.html", title="申请成功", content="请等待管理员通过你的申请吧", icon="ion-checkmark-circled", active="none", id=None, ) else: # 这个账户已经申请过,在临时表里有记录 self.render( "error.html", title=None, content="请等待管理员通过你的申请吧", icon="ion-alert-circled", active="none", id=None, ) else: # 账户已经存在, 一个账户只能存在于一个用户组里 self.render( "error.html", title=None, content="这个号码已经被注册过了", icon="ion-alert-circled", active="none", id=None, ) except Exception as e: print ("Error!", e) self.render( "error.html", title="申请失败", content="出错啦,请重新申请新用户", icon="ion-alert-circled", active="none", id=None )
def post(self): if not self.get_secure_cookie("id"): uid = self.get_argument("pwdid") ug = self.get_argument("ug") email = self.get_argument("email") vcode = self.get_argument("vcode") if vcode.lower() == self.get_secure_cookie("v").lower(): user = None if ug == "student": user = getStudent(uid) else: user = getTeacher(uid) if user is not None: if email == user["email"]: u = {"uid": uid, "pwd": user["pwd"]} print send_forget_mail(email, u) self.render( "error.html", title="邮件已发送", content=""" <label>您的密码已发送到邮箱</label> <br><br> 请<a href="http://mail.%s">进入邮箱</a>查收 """ % email.split("@")[-1], icon="ion-happy", active=None, id=None, ) else: self.render( "error.html", title="邮箱输入错误", content="请输入申请帐时使用的邮箱", icon="ion-close-circled", active=None, id=None, ) else: self.render( "error.html", title="用户不存在", content="用户不存在", icon="ion-close-circled", active=None, id=None ) else: self.render( "error.html", title="验证码错误", content=""" <label>验证码错误</label> <br><br> 请<a href="/forgetpwd">返回</a>重新输入 """, icon="ion-sad", active=None, id=None, ) remove_pic(self.pic_name) self.clear_cookie("v")