减少密码哈希迭代次数防止把手机卡烂

原来的登录和注册界面改为密码登录和邮箱登录
邮箱登录界面不再分状态,设置密码独立出一个界面
自动登录不再检测本地用过密码登录,第一次邮箱登录不设置密码但存了token也可以
整理代码
This commit is contained in:
MrZ_26
2022-10-23 04:36:19 +08:00
parent f9bbb8fce6
commit d12f8a27e7
23 changed files with 313 additions and 220 deletions

View File

@@ -372,6 +372,7 @@ return{
league="Tech League",
ffa="FFA",
rooms="Rooms",
resetPW="Reset password",
logout="Log out",
},
net_league={
@@ -698,21 +699,26 @@ return{
music="BGMs",
label="label",
},
login={
login_pw={
title="Sign In",
register="Sign Up",
login_mail="Login with E-mail/Sign Up",
email="Email Address",
password="Password",
showEmail="Show Email",
login="Log In",
},
register={
title="Sign Up",
login="Sign In",
login_mail={
title="Sign In/Sign Up",
login_pw="Password Sign In",
email="Email Address",
send="Send code",
code="Verification Code",
verify="Verify",
},
reset_password={
title="Reset Password",
send="Send code",
code="Verification Code",
password="Password",
password2="Re-enter Password",
setPW="Set Password",

View File

@@ -372,6 +372,7 @@ return{
league="Liga Tech",
ffa="FFA",
rooms="Salas",
-- resetPW="Reset password",
logout="Desconec.",
},
net_league={
@@ -690,21 +691,26 @@ return{
music="BGMs",
label="Etiq.",
},
login={
login_pw={
title="Entrar",
register="Registrarse",
-- login_mail="Login with E-mail/Sign Up",
email="Correo Elec.",
password="Contraseña",
showEmail="Mostrar Correo",
login="Entrar",
},
register={
title="Registrarse",
login="Entrar",
login_mail={
title="Entrar/Registrarse",
-- login_pw="Password Sign In",
email="Correo Elec.",
-- send="Send code",
-- code="Verification Code",
-- verify="Verify",
},
reset_password={
-- title="Reset Password",
-- send="Send code",
-- code="Verification Code",
password="Contraseña",
password2="Repetir Contr.",
-- setPW="Set Password",

View File

@@ -335,6 +335,7 @@ return{
-- league="Tech League",
ffa="FFA",
rooms="Salons",
-- resetPW="Reset password",
-- logout="Log out",
},
net_league={
@@ -652,21 +653,26 @@ return{
music="Musique",
-- label="label",
},
login={
login_pw={
title="Connexion",
register="Enregistrement",
-- login_mail="Login with E-mail/Sign Up",
email="E-mail",
password="Mot de passe",
-- showEmail="Show Email",
login="Connexion",
},
register={
title="Enregistrement",
login="Connexion",
login_mail={
title="Connexion/Enregistrement",
-- login_pw="Password Sign In",
email="E-mail",
-- send="Send code",
-- code="Verification Code",
-- verify="Verify",
},
reset_password={
-- title="Reset Password",
-- send="Send code",
-- code="Verification Code",
password="Mot de passe",
password2="Confirmer le mot de passe",
-- setPW="Set Password",

View File

@@ -373,6 +373,7 @@ return{
league="Tech League",
ffa="FFA",
rooms="Ruang-ruang",
-- resetPW="Reset password",
logout="Log out",
},
net_league={
@@ -699,21 +700,26 @@ return{
music="Musik",
label="label",
},
login={
login_pw={
title="Masuk",
register="Daftar",
-- login_mail="Login with E-mail/Sign Up",
email="Alamat Email",
password="Password",
showEmail="Tunjukkan Email",
login="Masuk",
},
register={
title="Daftar",
login="Masuk",
login_mail={
title="Masuk/Daftar",
-- login_pw="Password Sign In",
email="Alamat Email",
-- send="Send code",
-- code="Verification Code",
-- verify="Verify",
},
reset_password={
-- title="Reset Password",
-- send="Send code",
-- code="Verification Code",
password="Password",
password2="Ulangi Password",
-- setPW="Set Password",

View File

@@ -374,6 +374,7 @@ return{
league="テクリーグ",
ffa="自由乱闘戦",
rooms="ルーム・プライベート戦",
-- resetPW="Reset password",
logout="ログアウト",
},
net_league={
@@ -700,21 +701,26 @@ return{
music="",
label="ラベル",
},
login={
login_pw={
title="サインイン",
register="サインアップ",
-- login_mail="Login with E-mail/Sign Up",
email="Eメールアドレス",
password="パスワード",
-- showEmail="Show Email",
login="ログイン",
},
register={
title="サインアップ",
login="サインイン",
login_mail={
title="サインイン/サインアップ",
-- login_pw="Password Sign In",
email="Eメールアドレス",
-- send="Send code",
-- code="Verification Code",
-- verify="Verify",
},
reset_password={
-- title="Reset Password",
-- send="Send code",
-- code="Verification Code",
password="パスワード",
password2="パスワード(確認)",
-- setPW="Set Password",

View File

@@ -361,6 +361,7 @@ return{
-- league="Tech League",
ffa="FFA",
rooms="Salas",
-- resetPW="Reset password",
-- logout="Log out",
},
net_league={
@@ -688,21 +689,26 @@ return{
-- music="BGMs",
-- label="label",
},
login={
login_pw={
title="Log in",
register="Registrar",
-- login_mail="Login with E-mail/Sign Up",
email="Endereço De Email",
password="Senha",
-- showEmail="Show Email",
login="Log in",
},
register={
title="Registrar",
login="Log in",
login_mail={
title="Log in/Registrar",
-- login_pw="Password Sign In",
email="Endereço De Email",
-- send="Send code",
-- code="Verification Code",
-- verify="Verify",
},
reset_password={
-- title="Reset Password",
-- send="Send code",
-- code="Verification Code",
password="Senha",
password2="Entre Senha Novamente",
-- setPW="Set Password",

View File

@@ -166,6 +166,7 @@ return{
league="TL",
ffa="FFA",
rooms="< >",
resetPW="R ***",
logout="@_@x",
},
net_league={
@@ -483,21 +484,26 @@ return{
music="~~~",
label="...",
},
login={
login_pw={
title="Log in",
register="Sign up",
-- login_mail="Login with E-mail/Sign Up",
email="@",
password="*",
showEmail="?",
login="Log in",
login="",
},
register={
title="Sign up",
login="Log in",
login_mail={
title="Log in/Sign up",
login_pw="*** →",
email="@",
send="",
code="",
verify="!",
},
reset_password={
title="R ***",
send="",
code="",
password="*",
password2="*",
setPW="##",

View File

@@ -373,6 +373,7 @@ return{
league="Tech League",
ffa="FFA",
rooms="房间列表",
resetPW="重置密码",
logout="退出登录",
},
net_league={
@@ -698,23 +699,28 @@ return{
path="打开存储目录",
save="用户档案管理",
},
login={
login_pw={
title="登录",
register="注册",
login_mail="邮箱登录/注册",
email="邮箱",
password="密码",
showEmail="显示邮箱",
login="登录",
},
register={
title="注册",
login="登录",
email="邮箱:",
login_mail={
title="登录/注册",
login_pw="密码登录",
email="邮箱",
send="发送验证码",
code="验证码",
verify="验证邮箱",
password="密码:",
password2="确认密码:",
},
reset_password={
title="重置密码",
send="发送验证码",
code="验证码",
password="密码",
password2="确认密码",
setPW="设置密码",
},
account={

View File

@@ -374,6 +374,7 @@ return{
league="M.TechLeague();",
ffa="M.FFA",
rooms="M.Rooms();",
resetPW="M.ResetPW",
logout="M.Logout();",
},
net_league={
@@ -699,21 +700,26 @@ return{
path="OpenPath();",
save="DataManagement();",
},
login={
login_pw={
title="LogIn.UI",
register="Register();",
login_mail="Login_mail_sign_up()",
email="Email=",
password="Password=",
showEmail="ShowEmail",
login="Login();",
},
register={
title="Register.UI",
login="Login();",
login_mail={
title="LogIn_Register.UI",
login_pw="Login_pw();",
email="Email=",
send="Send();",
code="V-code=",
verify="Verify();",
},
reset_password={
title="Reset_Password.UI",
send="Send();",
code="V-code=",
password="Password=",
password2="RePassword=",
setPW="SetPassword();",

View File

@@ -373,6 +373,7 @@ return{
league="Tech League",
ffa="FFA",
rooms="房間列表",
resetPW="重設密碼",
logout="登出",
},
net_league={
@@ -698,21 +699,26 @@ return{
path="打開存儲目錄",
save="用戶資料管理",
},
login={
login_pw={
title="登錄",
register="註冊",
login_mail="電郵登錄/注册",
email="電郵",
password="密碼",
showEmail="顯示郵箱",
login="登錄",
},
register={
title="註冊",
login="登錄",
login_mail={
title="登錄/註冊",
login_pw="密碼登錄",
email="電郵",
send="發送驗證碼",
code="驗證碼",
verify="驗證郵箱",
},
reset_password={
title="重設密碼",
send="發送驗證碼",
code="驗證碼",
password="密碼",
password2="確認密碼",
setPW="設置密碼",

View File

@@ -132,19 +132,14 @@ function NET.getCode(email)
body={email=email},
},12.6)
if res then
if res.code==200 then
USER.email=email
saveUser()
SCN.fileDropped(2)
MES.new('info',text.checkEmail,5)
end
if res and res.code==200 then
MES.new('info',text.checkEmail,5)
end
WAIT.interrupt()
end)
end
function NET.codeLogin(code)
function NET.codeLogin(email,code)
if not TASK.lock('codeLogin') then return end
TASK.new(function()
WAIT{
@@ -159,7 +154,7 @@ function NET.codeLogin(code)
pool='codeLogin',
path='/techmino/api/v1/auth/login/email',
body={
email=USER.email,
email=email,
code=code,
},
},6.26)
@@ -176,7 +171,7 @@ function NET.codeLogin(code)
USER.aToken=res.data.accessToken
saveUser()
SCN.pop()SCN.push('net_menu')
SCN.fileDropped(3)
SCN.go('reset_password','fade')
end
end
@@ -194,7 +189,24 @@ function NET.setPW(code,pw)
timeout=6.26,
}
pw=HASH.pbkdf2(HASH.sha3_256,pw,'salt',26000)
local salt do
local res=getMsg({
pool='pwLogin',
path='/techmino/api/v1/auth/seed/email',
body={
email=USER.email,
},
},6.26)
if res and res.code==200 then
salt=res.data
else
WAIT.interrupt()
return
end
end
pw=HASH.pbkdf2(HASH.sha3_256,pw,salt,260)
local res=getMsg({
pool='setPW',
@@ -219,7 +231,6 @@ function NET.setPW(code,pw)
end)
end
function NET.autoLogin()
if not USER.password then SCN.go('login') return end
if not TASK.lock('autoLogin') then return end
TASK.new(function()
WAIT{
@@ -297,7 +308,7 @@ function NET.autoLogin()
end
end
SCN.go('login')
SCN.go('login_pw')
WAIT.interrupt()
end)
end
@@ -313,26 +324,45 @@ function NET.pwLogin(email,pw)
}
TEST.yieldT(.26)
pw=HASH.pbkdf2(HASH.sha3_256,pw,"salt",26000)
local salt do
local res=getMsg({
pool='pwLogin',
path='/techmino/api/v1/auth/seed/email',
body={
email=email,
},
},6.26)
local res=getMsg({
pool='pwLogin',
path='/techmino/api/v1/auth/login/email',
body={
email=email,
password=pw,
},
},6.26)
if res and res.code==200 then
salt=res.data
else
WAIT.interrupt()
return
end
end
if res then
if res.code==200 then
USER.email=email
USER.password=pw
USER.rToken=res.data.refreshToken
USER.aToken=res.data.accessToken
saveUser()
NET.ws_connect()
SCN.go('net_menu')
pw=HASH.pbkdf2(HASH.sha3_256,pw,salt,260)
do
local res=getMsg({
pool='pwLogin',
path='/techmino/api/v1/auth/login/email',
body={
email=email,
password=pw,
},
},6.26)
if res then
if res.code==200 then
USER.email=email
USER.password=pw
USER.rToken=res.data.refreshToken
USER.aToken=res.data.accessToken
saveUser()
NET.ws_connect()
SCN.go('net_menu')
end
end
end

View File

@@ -17,6 +17,8 @@ local history,hisPtr={"?"}
local sumode=false
local the_secret=(0xe^2*10)..(2*0xb)
local scene={}
local commands={} do
--[[
format of elements in table 'commands':
@@ -708,7 +710,7 @@ local commands={} do
outputBox.h=500
local button=WIDGET.newButton{name='bye',x=640,y=615,w=426,h=100,code=function()
TASK.new(function()
WIDGET.active.bye.hide=true
scene.widgetList.bye.hide=true
for _=1,30 do coroutine.yield() end
log{C.R,"Deleting all data in 10..."}SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60)
log{C.R,"Deleting all data in 9..."}SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60)
@@ -726,7 +728,7 @@ local commands={} do
end)
end}
button:setObject("Techmino is fun. Bye.")
ins(WIDGET.active,button)
ins(scene.widgetList,button)
else
log"Are you sure you want to reset everything?"
log"This will delete EVERYTHING in your saved game data, including but not limited to:"
@@ -1012,8 +1014,6 @@ userG.the_key=first_key
local scene={}
function scene.sceneInit()
WIDGET.focus(inputBox)
BG.set('none')

View File

@@ -72,7 +72,7 @@ function scene.keyDown(key)
local l={1,2,3,4,5,6,7}
repeat scene.keyDown(rem(l,math.random(#l))) until not l[1]
elseif key=='tab' then
WIDGET.active.sequence:scroll(kb.isDown('lshift','rshift') and -1 or 1)
scene.widgetList.sequence:scroll(kb.isDown('lshift','rshift') and -1 or 1)
elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then
if #BAG>0 then
sys.setClipboardText("Techmino SEQ:"..DATA.copySequence())

View File

@@ -18,24 +18,24 @@ local repRateStrings={[0]="pause",[.125]="0.125x",[.5]="0.5x",[1]="1x",[2]="2x",
local scene={}
local function _updateMenuButtons()
WIDGET.active.restart.hide=replaying
scene.widgetList.restart.hide=replaying
local pos=(GAME.tasUsed or replaying) and 'right' or SETTING.menuPos
modeTextWidK=math.min(280/TEXTOBJ.modeName:getWidth(),1)
if GAME.replaying then
WIDGET.active.pause.x=1195
scene.widgetList.pause.x=1195
modeTextPos=1185-TEXTOBJ.modeName:getWidth()*modeTextWidK
elseif pos=='right' then
WIDGET.active.restart.x=1125
WIDGET.active.pause.x=1195
scene.widgetList.restart.x=1125
scene.widgetList.pause.x=1195
modeTextPos=1115-TEXTOBJ.modeName:getWidth()*modeTextWidK
elseif pos=='middle' then
WIDGET.active.restart.x=360
WIDGET.active.pause.x=860
scene.widgetList.restart.x=360
scene.widgetList.pause.x=860
modeTextPos=940
elseif pos=='left' then
WIDGET.active.restart.x=120
WIDGET.active.pause.x=190
scene.widgetList.restart.x=120
scene.widgetList.pause.x=190
modeTextPos=1200-TEXTOBJ.modeName:getWidth()*modeTextWidK
end
end

View File

@@ -2,7 +2,7 @@ local scene={}
function scene.sceneInit()
BG.set('cubes')
WIDGET.active.texts:setTexts(require"parts.updateLog":split("\n"))
scene.widgetList.texts:setTexts(require"parts.updateLog":split("\n"))
end
function scene.wheelMoved(_,y)
@@ -10,13 +10,13 @@ function scene.wheelMoved(_,y)
end
function scene.keyDown(key)
if key=='up' then
WIDGET.active.texts:scroll(-5)
scene.widgetList.texts:scroll(-5)
elseif key=='down' then
WIDGET.active.texts:scroll(5)
scene.widgetList.texts:scroll(5)
elseif key=='pageup' then
WIDGET.active.texts:scroll(-20)
scene.widgetList.texts:scroll(-20)
elseif key=='pagedown' then
WIDGET.active.texts:scroll(20)
scene.widgetList.texts:scroll(20)
elseif key=='escape' then
SCN.back()
end

View File

@@ -3,9 +3,9 @@ function scene.sceneInit()
BG.set('cubes')
local fileData=love.filesystem.read("legals.md")
if fileData then
WIDGET.active.texts:setTexts(fileData:split('\n'))
scene.widgetList.texts:setTexts(fileData:split('\n'))
else
WIDGET.active.texts:setTexts{"[legals.md not found]"}
scene.widgetList.texts:setTexts{"[legals.md not found]"}
end
end
@@ -14,13 +14,13 @@ function scene.wheelMoved(_,y)
end
function scene.keyDown(key)
if key=='up' then
WIDGET.active.texts:scroll(-5)
scene.widgetList.texts:scroll(-5)
elseif key=='down' then
WIDGET.active.texts:scroll(5)
scene.widgetList.texts:scroll(5)
elseif key=='pageup' then
WIDGET.active.texts:scroll(-20)
scene.widgetList.texts:scroll(-20)
elseif key=='pagedown' then
WIDGET.active.texts:scroll(20)
scene.widgetList.texts:scroll(20)
elseif key=='escape' then
SCN.back()
end

View File

@@ -0,0 +1,54 @@
local scene={}
local function _getCode()
local email=scene.widgetList.email:getText()
if not STRING.simpEmailCheck(email) then
MES.new('error',text.wrongEmail)
else
USER.email=email
NET.getCode(email)
end
end
local function _codeLogin()
local code=scene.widgetList.code:getText():upper()
if #code~=8 then
MES.new('error',text.wrongCode)
else
NET.codeLogin(USER.email,code)
end
end
function scene.sceneInit()
scene.widgetList.email:setText(USER.email or "")
scene.widgetList.code:clear()
end
function scene.keyDown(key,rep)
if key=='escape' and not rep then
SCN.back()
elseif key=='return' then
if #scene.widgetList.code:getText():upper()==0 then
_getCode()
else
_codeLogin()
end
else
return true
end
end
scene.widgetList={
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
WIDGET.newButton{name='login_pw', x=1080,y=100,w=260,h=80,color='lY',code=function() SCN.swapTo('login_pw','swipeR') end},
WIDGET.newInputBox{name='email', x=380, y=200,w=626,h=60,limit=128},
WIDGET.newKey{name='send', x=640, y=330,w=300,h=80,font=40,code=_getCode},
WIDGET.newInputBox{name='code', x=380, y=400,w=626 ,h=60,limit=8},
WIDGET.newKey{name='verify', x=640, y=530,w=300,h=80,font=40,code=_codeLogin},
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

View File

@@ -28,13 +28,13 @@ function scene.keyDown(key,rep)
end
scene.widgetList={
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
WIDGET.newButton{name='register', x=1140,y=100,w=170,h=80,color='lY',code=function() SCN.swapTo('register','swipeR') end},
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
WIDGET.newButton{name='login_mail',x=1080,y=100,w=260,h=80,color='lY',code=function() SCN.swapTo('login_mail','swipeL') end},
emailBox,
passwordBox,
WIDGET.newSwitch{name='showEmail',x=550, y=420,disp=function() return showEmail end,code=function() showEmail=not showEmail emailBox.secret=not showEmail end},
WIDGET.newKey{name='login', x=1140,y=540,w=170,h=80,font=40,code=pressKey'return'},
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
WIDGET.newSwitch{name='showEmail', x=550, y=420,disp=function() return showEmail end,code=function() showEmail=not showEmail emailBox.secret=not showEmail end},
WIDGET.newKey{name='login', x=1140,y=540,w=170,h=80,font=40,code=pressKey'return'},
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
}
return scene

View File

@@ -4,9 +4,9 @@ function scene.sceneInit()
BG.set('cubes')
local fileData=FILE.load('parts/language/manual_'..(SETTING.locale:find'zh' and 'zh' or SETTING.locale:find'ja' and 'ja' or 'en')..'.txt','-string')
if fileData then
WIDGET.active.texts:setTexts(fileData:split('\n'))
scene.widgetList.texts:setTexts(fileData:split('\n'))
else
WIDGET.active.texts:setTexts{"[manual file not found]"}
scene.widgetList.texts:setTexts{"[manual file not found]"}
end
end
@@ -16,13 +16,13 @@ function scene.wheelMoved(_,y)
end
function scene.keyDown(key)
if key=='up' then
WIDGET.active.texts:scroll(-5)
scene.widgetList.texts:scroll(-5)
elseif key=='down' then
WIDGET.active.texts:scroll(5)
scene.widgetList.texts:scroll(5)
elseif key=='pageup' then
WIDGET.active.texts:scroll(-20)
scene.widgetList.texts:scroll(-20)
elseif key=='pagedown' then
WIDGET.active.texts:scroll(20)
scene.widgetList.texts:scroll(20)
elseif key=='escape' then
SCN.back()
end

View File

@@ -17,6 +17,9 @@ scene.widgetList={
WIDGET.newButton{name='league',x=640, y=180,w=350,h=120,font=40,color='D',code=goScene'net_league'},
WIDGET.newButton{name='ffa', x=640, y=360,w=350,h=120,font=40,color='D',code=function() MES.new('warn',text.notFinished)--[[NET.enterRoom({name='ffa'})]] end},
WIDGET.newButton{name='rooms', x=640, y=540,w=350,h=120,font=40,code=goScene'net_rooms'},
WIDGET.newButton{name='resetPW',x=680, y=40,w=180,h=60,color='dG',code=function()
SCN.go('reset_password','none')
end},
WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR',
code=function()
if tryBack() then

View File

@@ -1,98 +0,0 @@
local scene={}
local state
local code
local function _getCode()
local email=WIDGET.active.email:getText()
if not STRING.simpEmailCheck(email) then
MES.new('error',text.wrongEmail)
else
NET.getCode(email)
end
end
local function _codeLogin()
code=WIDGET.active.code:getText():upper()
if #code~=8 then
MES.new('error',text.wrongCode)
else
NET.codeLogin(code)
end
end
local function _setPW()
local password= WIDGET.active.password:getText()
local password2=WIDGET.active.password2:getText()
if #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.sceneInit()
state=SCN.args[1] or 1
scene.fileDropped(state)
end
function scene.keyDown(key,rep)
if key=='escape' and not rep then
if state==2 then
scene.fileDropped(state-1)
else
SCN.back()
end
elseif key=='return' then
if state==1 then
_getCode()
elseif state==2 then
_codeLogin()
elseif state==3 then
_setPW()
end
else
return true
end
end
function scene.fileDropped(arg)-- Not designed for this, but it works and no side effects
if type(arg)~='number' then return end
state=arg
scene.widgetList.email. hide=arg~=1
scene.widgetList.send. hide=arg~=1
scene.widgetList.code. hide=arg~=2
scene.widgetList.verify. hide=arg~=2
scene.widgetList.password. hide=arg~=3
scene.widgetList.password2. hide=arg~=3
scene.widgetList.setPW. hide=arg~=3
if arg==1 then
scene.widgetList.email:setText(USER.email or "")
elseif arg==2 then
scene.widgetList.code:clear()
elseif arg==3 then
scene.widgetList.password:clear()
scene.widgetList.password2:clear()
end
end
scene.widgetList={
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
WIDGET.newButton{name='login', x=1140,y=100,w=170,h=80,color='lY',code=function() SCN.swapTo('login','swipeL') end},
WIDGET.newInputBox{name='email', x=380, y=300,w=626,h=60,limit=128},
WIDGET.newKey{name='send', x=640, y=430,w=250,h=80,font=40,code=_getCode},
WIDGET.newInputBox{name='code', x=380, y=300,w=626,h=60,limit=8},
WIDGET.newKey{name='verify', x=640, y=430,w=300,h=80,font=40,code=_codeLogin},
WIDGET.newInputBox{name='password', x=380, y=250,w=626,h=60,secret=true,regex="[ -~]",limit=64},
WIDGET.newInputBox{name='password2',x=380, y=350,w=626,h=60,secret=true,regex="[ -~]",limit=64},
WIDGET.newKey{name='setPW', x=640, y=480,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

View File

@@ -0,0 +1,44 @@
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

View File

@@ -12,8 +12,8 @@ function scene.sceneInit()
last1,last2=0,0
sfxPack=SETTING.sfxPack
vocPack=SETTING.vocPack
WIDGET.active.sfxPack:reset()
WIDGET.active.vocPack:reset()
scene.widgetList.sfxPack:reset()
scene.widgetList.vocPack:reset()
BG.set()
end
function scene.sceneBack()