Files
Techmino/parts/scenes/reset_password.lua
MrZ_26 d12f8a27e7 减少密码哈希迭代次数防止把手机卡烂
原来的登录和注册界面改为密码登录和邮箱登录
邮箱登录界面不再分状态,设置密码独立出一个界面
自动登录不再检测本地用过密码登录,第一次邮箱登录不设置密码但存了token也可以
整理代码
2022-10-23 04:36:19 +08:00

45 lines
1.5 KiB
Lua

local scene={}
local function _setPW()
local code=scene.widgetList.code:getText():upper()
local password= scene.widgetList.password:getText()
local password2=scene.widgetList.password2:getText()
if #code~=8 then
MES.new('error',text.wrongCode)
elseif #password==0 or #password2==0 then
MES.new('error',text.noPassword)
elseif password~=password2 then
MES.new('error',text.diffPassword)
else
NET.setPW(code,password)
end
end
function scene.keyDown(key,rep)
if key=='escape' and not rep then
SCN.back()
elseif key=='return' then
if #scene.widgetList.code:getText()==0 then
_setPW()
else
NET.getCode(USER.email)
end
else
return true
end
end
scene.widgetList={
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
WIDGET.newKey{name='send', x=640, y=300,w=300,h=80,font=40,code=function() NET.getCode(USER.email) end},
WIDGET.newInputBox{name='code', x=380, y=170,w=626,h=60,limit=8},
WIDGET.newInputBox{name='password', x=380, y=370,w=626,h=60,secret=true,regex="[ -~]",limit=64},
WIDGET.newInputBox{name='password2',x=380, y=470,w=626,h=60,secret=true,regex="[ -~]",limit=64},
WIDGET.newKey{name='setPW', x=640, y=600,w=350,h=80,font=40,code=_setPW},
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
}
return scene