注册改造 忽略用户名邮箱 增加验证码codeid
This commit is contained in:
parent
9320b88f3f
commit
34edc89c95
@ -5,20 +5,36 @@ async def registerUser(ns):
|
|||||||
db = DBPools()
|
db = DBPools()
|
||||||
async with db.sqlorContext('kboss') as sor:
|
async with db.sqlorContext('kboss') as sor:
|
||||||
if ns:
|
if ns:
|
||||||
userns = {'username': ns['username']}
|
if ns.get('username'):
|
||||||
isuser = await sor.R('users', userns)
|
userns = {'username': ns['username']}
|
||||||
if len(isuser) >= 1:
|
isuser = await sor.R('users', userns)
|
||||||
return {'status': False, 'msg': '用户名已注册'}
|
if len(isuser) >= 1:
|
||||||
useremai = {'email': ns['email']}
|
return {'status': False, 'msg': '用户名已注册'}
|
||||||
isuser = await sor.R('users', useremai)
|
|
||||||
if len(isuser) >= 1:
|
if ns.get('email'):
|
||||||
return {'status': False, 'msg': '该邮箱已注册'}
|
useremai = {'email': ns['email']}
|
||||||
|
isuser = await sor.R('users', useremai)
|
||||||
|
if len(isuser) >= 1:
|
||||||
|
return {'status': False, 'msg': '该邮箱已注册'}
|
||||||
|
|
||||||
usermobile = {'mobile':ns['mobile']}
|
usermobile = {'mobile':ns['mobile']}
|
||||||
isuser = await sor.R('users', usermobile)
|
isuser = await sor.R('users', usermobile)
|
||||||
if len(isuser) >= 1:
|
if len(isuser) >= 1:
|
||||||
return {'status': False, 'msg': '该手机号已注册'}
|
return {'status': False, 'msg': '该手机号已注册'}
|
||||||
if len(ns.get('password')) < 6:
|
# 用户名没有 则用手机号作为用户名
|
||||||
return {'status': False, 'msg': '密码必须6位数以上'}
|
if not ns.get('username'):
|
||||||
|
ns['username'] = ns['mobile']
|
||||||
|
|
||||||
|
if ns.get('password'):
|
||||||
|
if len(ns.get('password')) < 6:
|
||||||
|
return {'status': False, 'msg': '密码必须6位数以上'}
|
||||||
|
|
||||||
|
if ns.get('codeid'):
|
||||||
|
type += 1
|
||||||
|
code = await sor.R('validatecode', {'id': ns.get('codeid'), 'vcode': ns.get('vcode')})
|
||||||
|
if len(code) < 1:
|
||||||
|
return {'status': False, 'msg': '验证码不正确'}
|
||||||
|
|
||||||
#通过邀请码注册
|
#通过邀请码注册
|
||||||
if ns.get('invitecode'):
|
if ns.get('invitecode'):
|
||||||
invitecodens = {}
|
invitecodens = {}
|
||||||
@ -124,7 +140,8 @@ async def registerUser(ns):
|
|||||||
userid = ns['id']
|
userid = ns['id']
|
||||||
|
|
||||||
# 加密用户密码
|
# 加密用户密码
|
||||||
ns['password'] = password_encode(ns['password'])
|
if ns.get('password'):
|
||||||
|
ns['password'] = password_encode(ns['password'])
|
||||||
ns['orgid'] = org_id
|
ns['orgid'] = org_id
|
||||||
|
|
||||||
# 新增用户信息
|
# 新增用户信息
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user