def regist(self, mobile, mobile_captcha, name, password1, password2, captcha, code, agree): print('------------------') print(mobile_captcha) print(captcha) print('------------------') if agree == "": return {'status': False, 'msg': '请点击同意条款'} if self.conn.get("captcha:%s" % code) != captcha: return {'status': False, 'msg': '图形验证码不正确'} if self.conn.get("mobile_code:%s" % mobile) != mobile_captcha: return {'status': False, 'msg': '短信验证码不正确'} user = User.by_name(name) # print(type(user)) # print(user) if name == "": return {'status': False, 'msg': '用户名不能为空'} if user != None: return {'status': False, 'msg': '用户已经存在'} if password1 != password2 and password1 != None: return {'status': False, 'msg': '两次密码不一致'} #存入数据库 user = User() user.username = name user.password = password2 user.mobile = mobile self.db.add(user) self.db.commit() return {'status': True, 'msg': "注册成功"}
def regist(self, name, mobile, mobile_captcha, password1, password2, captcha, code): """04注册函数 判断类型 边界值 """ if self.conn.get("captcha:%s" % code) != captcha.lower(): flash(self, '图片验证码不正确', 'error') return {'status': False, 'msg': '图片验证码不正确'} if self.conn.get("mobile_code:%s" % mobile) != mobile_captcha: flash(self, '短信验证码不正确', 'error') return {'status': False, 'msg': '短信验证码不正确'} if password1 != password2: flash(self, '两次密码不一致', 'error') return {'status': False, 'msg': '两次密码不一致'} #存入数据库 user = User.by_name(name) if user is not None: flash(self, '用户名已存在', 'error') return {'status': False, 'msg': '用户名已存在'} user = User() user.name = name user.password = password2 user.mobile = mobile self.db.add(user) self.db.commit() flash(self, '注册成功', 'success') return {'status': True, 'msg': '注册成功'}
def regist(self, name, mobile, mobile_captcha, password1, password2, captcha, code): """04注册函数 一个是类型,一个边界值 """ if self.conn.get("captcha:%s" % code) != captcha.lower(): return {'status': False, 'msg': '图形验证码不正确'} if self.conn.get("mobile_code:%s" % mobile) != mobile_captcha: return {'status': False, 'msg': '短信验证码不正确'} if password1 != password2: return {'status': False, 'msg': '两次密码不一致'} #存入数据库 user = User.by_name(name) if user is not None: return {'status': False, 'msg': '用户已经存在'} user = User() user.name = name user.password = password2 user.mobile = mobile self.db.add(user) self.db.commit() return {'status': True, 'msg': "注册成功"}
def regist(self, name, mobile, mobile_captcha, password1, password2, agree): if agree == "": return {'status':False, 'msg':"您没有点击同意条款"} if password1 != password2: return {'status': False, 'msg': "两次密码不相同"} if self.conn.get('mobile_code:%s' %mobile) != mobile_captcha: return {'status': False, 'msg': "短信验证码不正确"} user= User.by_name(name) if user is not None: return {'status': False, 'msg': "用户已经存在,请换一个名称"} user = User() user.name = name user.password = password2 print user.password user.mobile = mobile self.db.add(user) self.db.commit() return {'status': True}
def regist(self, name, mobile, mobile_captcha, password1, password2, agree): ''' user rigist ''' if agree == '': return {'status': False, 'msg': "您没有点击同意条款"} if password1 != password2: return {'status': False, 'msg': "两次输入密码不一致"} if self.conn.get('mobile_code:%s' % mobile) != mobile_captcha: return {'status': False, 'msg': "短信验证码错误"} user = User.by_name(name) if user: return {'status': False, 'msg': "用户名已经存在"} user = User() user.name = name user.password = password1 user.mobile = mobile self.db.add(user) self.db.commit() print 'True' return {'status': True, 'msg': '注册成功'}
def regist(self, mobile, mobile_captcha, code, name, password1, password2, captcha, agree): """注册函数""" user = User.by_name(name) if user is not None: return {'status': False, 'msg': '用户名已经存在,请换一个名称'} if password1 != password2: return {'status': False, 'msg': '两次密码不一致'} if self.conn.get('mobile_code:%s' % mobile) != mobile_captcha: return {'status': False, 'msg': '短信验证码不正确'} if agree == "": return {'status': False, 'msg': '您没有同意条款'} # 操作数据库内容 user = User() user.name = name user.password = password2 user.mobile = mobile self.db.add(user) self.db.commit() # 提交数据库 return {'status': True}