update logintype
This commit is contained in:
parent
22204bedec
commit
19ba9aac26
@ -43,6 +43,50 @@ async def logintype(ns):
|
|||||||
|
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
async with db.sqlorContext('kboss') as sor:
|
async with db.sqlorContext('kboss') as sor:
|
||||||
|
|
||||||
|
domain_name = ns.get('domain_name')
|
||||||
|
if domain_name in ['www.opencomputing.cn', 'dev.opencomputing.cn', 'localhost:9527'] and ns.get('username') != '开元云(北京)科技有限公司':
|
||||||
|
if not ns.get('mobile'):
|
||||||
|
return {
|
||||||
|
'status': False,
|
||||||
|
'msg': '请输入手机号'
|
||||||
|
}
|
||||||
|
real_mobile_li = await sor.R('users', {'username': ns['username']})
|
||||||
|
if not real_mobile_li:
|
||||||
|
return {
|
||||||
|
'status': False,
|
||||||
|
'msg': '用户名有误'
|
||||||
|
}
|
||||||
|
real_mobile = real_mobile_li[0]['mobile'] if real_mobile_li else None
|
||||||
|
if not real_mobile:
|
||||||
|
return {
|
||||||
|
'status': False,
|
||||||
|
'msg': '未查询到匹配得手机号码'
|
||||||
|
}
|
||||||
|
|
||||||
|
if real_mobile and ns['mobile'] != real_mobile:
|
||||||
|
return {
|
||||||
|
'status': False,
|
||||||
|
'msg': '您的手机号与用户名不匹配'
|
||||||
|
}
|
||||||
|
|
||||||
|
if not ns.get('codeid'):
|
||||||
|
return {
|
||||||
|
'status': False,
|
||||||
|
'msg': 'codeid不存在, 请输入验证码'
|
||||||
|
}
|
||||||
|
code = await sor.R('validatecode', {'id': ns.get('codeid'), 'vcode': ns.get('vcode')})
|
||||||
|
if len(code) < 1:
|
||||||
|
return {'status': False, 'msg': '验证码不正确'}
|
||||||
|
|
||||||
|
password = password_encode(ns['password'])
|
||||||
|
users = await sor.R('users', {'username': ns.get('username'), 'password': password})
|
||||||
|
if len(users) < 1:
|
||||||
|
return {"status": False,'msg':'用户名或密码错误'}
|
||||||
|
|
||||||
|
return {'status': True}
|
||||||
|
|
||||||
|
else:
|
||||||
type = 0
|
type = 0
|
||||||
if ns.get('codeid'):
|
if ns.get('codeid'):
|
||||||
type += 1
|
type += 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user