更新登录界面
This commit is contained in:
4
main.lua
4
main.lua
@@ -601,8 +601,8 @@ for _,fileName in next,fs.getDirectoryItems('replay') do
|
|||||||
end
|
end
|
||||||
table.sort(REPLAY,function(a,b) return a.fileName>b.fileName end)
|
table.sort(REPLAY,function(a,b) return a.fileName>b.fileName end)
|
||||||
|
|
||||||
WS.switchHost('cafuuchino1.3322.org','10026','/techmino/ws/v1')
|
WS.switchHost('cafuuchino1.3322.org','10027','/techmino/ws/v1')
|
||||||
HTTP.setHost("cafuuchino1.3322.org:10026")
|
HTTP.setHost("cafuuchino1.3322.org:10027")
|
||||||
HTTP.setThreadCount(1)
|
HTTP.setThreadCount(1)
|
||||||
|
|
||||||
table.insert(_LOADTIMELIST_,("Load Resources: %.3fs"):format(TIME()-_LOADTIME_))
|
table.insert(_LOADTIMELIST_,("Load Resources: %.3fs"):format(TIME()-_LOADTIME_))
|
||||||
|
|||||||
@@ -587,10 +587,8 @@ do-- Userdata tables
|
|||||||
USER=setmetatable({-- User infomation
|
USER=setmetatable({-- User infomation
|
||||||
__data={
|
__data={
|
||||||
uid=false,
|
uid=false,
|
||||||
email=false,
|
|
||||||
password=false,
|
|
||||||
rToken=false,
|
|
||||||
aToken=false,
|
aToken=false,
|
||||||
|
oToken=false,
|
||||||
},
|
},
|
||||||
},{
|
},{
|
||||||
__index=function(self,k)
|
__index=function(self,k)
|
||||||
|
|||||||
@@ -744,12 +744,11 @@ return {
|
|||||||
music="BGMs",
|
music="BGMs",
|
||||||
label="label",
|
label="label",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="Sign In/Sign Up",
|
title="Sign In",
|
||||||
email="Email Address",
|
ticket="Auth Ticket",
|
||||||
send="Send code",
|
authorize="Open Authorizing Page",
|
||||||
code="Verification Code",
|
submit="Submit",
|
||||||
verify="Verify",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
title="Reset Password",
|
title="Reset Password",
|
||||||
|
|||||||
@@ -736,12 +736,11 @@ return {
|
|||||||
music="BGMs",
|
music="BGMs",
|
||||||
label="Etiq.",
|
label="Etiq.",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="Entrar/Registrarse",
|
-- title="Sign In",
|
||||||
email="Correo Elec.",
|
-- ticket="Auth Ticket",
|
||||||
send="Enviar código",
|
-- authorize="Open Authorizing Page",
|
||||||
code="Código de Verif.",
|
-- submit="Submit",
|
||||||
verify="Verificar",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
title="Restablecer Contraseña",
|
title="Restablecer Contraseña",
|
||||||
|
|||||||
@@ -699,12 +699,11 @@ return {
|
|||||||
music="Musique",
|
music="Musique",
|
||||||
-- label="label",
|
-- label="label",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="Connexion/Enregistrement",
|
-- title="Sign In",
|
||||||
email="E-mail",
|
-- ticket="Auth Ticket",
|
||||||
-- send="Send code",
|
-- authorize="Open Authorizing Page",
|
||||||
-- code="Verification Code",
|
-- submit="Submit",
|
||||||
-- verify="Verify",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
-- title="Reset Password",
|
-- title="Reset Password",
|
||||||
|
|||||||
@@ -745,12 +745,11 @@ return {
|
|||||||
music="Musik",
|
music="Musik",
|
||||||
label="label",
|
label="label",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="Masuk/Daftar",
|
-- title="Sign In",
|
||||||
email="Alamat Email",
|
-- ticket="Auth Ticket",
|
||||||
-- send="Send code",
|
-- authorize="Open Authorizing Page",
|
||||||
-- code="Verification Code",
|
-- submit="Submit",
|
||||||
-- verify="Verify",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
-- title="Reset Password",
|
-- title="Reset Password",
|
||||||
|
|||||||
@@ -746,12 +746,11 @@ return {
|
|||||||
music="曲",
|
music="曲",
|
||||||
label="ラベル",
|
label="ラベル",
|
||||||
},
|
},
|
||||||
login_mail={
|
logi={
|
||||||
title="サインイン/サインアップ",
|
-- title="Sign In",
|
||||||
email="Eメールアドレス",
|
-- ticket="Auth Ticket",
|
||||||
send="認証コード送信",
|
-- authorize="Open Authorizing Page",
|
||||||
code="認証コード",
|
-- submit="Submit",
|
||||||
verify="認証",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
title="パスワード再設定",
|
title="パスワード再設定",
|
||||||
|
|||||||
@@ -734,12 +734,11 @@ return {
|
|||||||
-- music="BGMs",
|
-- music="BGMs",
|
||||||
-- label="label",
|
-- label="label",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="Log in/Registrar",
|
-- title="Sign In",
|
||||||
email="Endereço De Email",
|
-- ticket="Auth Ticket",
|
||||||
-- send="Send code",
|
-- authorize="Open Authorizing Page",
|
||||||
-- code="Verification Code",
|
-- submit="Submit",
|
||||||
-- verify="Verify",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
-- title="Reset Password",
|
-- title="Reset Password",
|
||||||
|
|||||||
@@ -485,12 +485,11 @@ return {
|
|||||||
music="~~~",
|
music="~~~",
|
||||||
label="...",
|
label="...",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="Log in/Sign up",
|
title="Sign In",
|
||||||
email="@",
|
-- ticket="Auth Ticket",
|
||||||
send="→",
|
-- authorize="Open Authorizing Page",
|
||||||
code="←",
|
-- submit="Submit",
|
||||||
verify="!",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
title="R ***",
|
title="R ***",
|
||||||
|
|||||||
@@ -744,12 +744,11 @@ return {
|
|||||||
path="打开存储目录",
|
path="打开存储目录",
|
||||||
save="用户档案管理",
|
save="用户档案管理",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="登录/注册",
|
title="登录",
|
||||||
email="邮箱",
|
ticket="授权令牌",
|
||||||
send="发送验证码",
|
authorize="打开授权页面",
|
||||||
code="验证码",
|
submit="提交",
|
||||||
verify="验证邮箱",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
title="重置密码",
|
title="重置密码",
|
||||||
|
|||||||
@@ -693,12 +693,11 @@ return {
|
|||||||
path="OpenPath();",
|
path="OpenPath();",
|
||||||
save="DataManagement();",
|
save="DataManagement();",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="LogIn_Register.UI",
|
title="SignIn.UI",
|
||||||
email="Email=",
|
ticket="Ticket=",
|
||||||
send="Send();",
|
authorize="Authorize()",
|
||||||
code="V-code=",
|
submit="Submit()",
|
||||||
verify="Verify();",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
title="Reset_Password.UI",
|
title="Reset_Password.UI",
|
||||||
|
|||||||
@@ -744,12 +744,11 @@ return {
|
|||||||
path="打開存儲目錄",
|
path="打開存儲目錄",
|
||||||
save="用戶資料管理",
|
save="用戶資料管理",
|
||||||
},
|
},
|
||||||
login_mail={
|
login={
|
||||||
title="登錄/註冊",
|
title="登錄",
|
||||||
email="電郵",
|
-- ticket="Auth Ticket",
|
||||||
send="發送驗證碼",
|
-- authorize="Open Authorizing Page",
|
||||||
code="驗證碼",
|
-- submit="Submit",
|
||||||
verify="驗證郵箱",
|
|
||||||
},
|
},
|
||||||
reset_password={
|
reset_password={
|
||||||
title="重設密碼",
|
title="重設密碼",
|
||||||
|
|||||||
@@ -1,47 +1,41 @@
|
|||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
local function _getCode()
|
local function _authorize()
|
||||||
local email=scene.widgetList.email:getText()
|
love.system.openURL("https://dev.studio26f.org/oauth?product=techmino")
|
||||||
if not STRING.simpEmailCheck(email) then
|
|
||||||
MES.new('error',text.wrongEmail)
|
|
||||||
else
|
|
||||||
USER.email=email
|
|
||||||
NET.getCode(email)
|
|
||||||
end
|
end
|
||||||
end
|
local function _submit()
|
||||||
local function _codeLogin()
|
local tickets=scene.widgetList.ticket:getText():upper()
|
||||||
local code=scene.widgetList.code:getText():upper()
|
if #tickets~=128 then
|
||||||
if #code~=8 then
|
|
||||||
MES.new('error',text.wrongCode)
|
MES.new('error',text.wrongCode)
|
||||||
else
|
else
|
||||||
NET.codeLogin(USER.email,code)
|
USER.aToken=tickets:sub(1,64)
|
||||||
|
USER.oToken=tickets:sub(65)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function _paste()
|
local function _paste()
|
||||||
local t=love.system.getClipboardText()
|
local t=love.system.getClipboardText()
|
||||||
if t then
|
if t then
|
||||||
t=STRING.trim(t)
|
t=STRING.trim(t)
|
||||||
if #t==8 and t:match("[0-9]+") then
|
if #t==128 and t:match("[0-9A-Z]+") then
|
||||||
scene.widgetList.code:setText(t)
|
scene.widgetList.ticket:setText(t)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
MES.new('warn',text.wrongCode)
|
MES.new('error',text.wrongCode)
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.enter()
|
function scene.enter()
|
||||||
scene.widgetList.email:setText(USER.email or "")
|
scene.widgetList.ticket:clear()
|
||||||
scene.widgetList.code:clear()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function scene.keyDown(key,rep)
|
function scene.keyDown(key,rep)
|
||||||
if key=='escape' and not rep then
|
if key=='escape' and not rep then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
elseif key=='return' or key=='kpenter' then
|
elseif key=='return' or key=='kpenter' then
|
||||||
if #scene.widgetList.code:getText():upper()==0 then
|
if #scene.widgetList.ticket:getText()==0 then
|
||||||
_getCode()
|
_authorize()
|
||||||
else
|
else
|
||||||
_codeLogin()
|
_submit()
|
||||||
end
|
end
|
||||||
elseif key=='v' and love.keyboard.isDown('lctrl','rctrl') then
|
elseif key=='v' and love.keyboard.isDown('lctrl','rctrl') then
|
||||||
_paste()
|
_paste()
|
||||||
@@ -52,14 +46,12 @@ end
|
|||||||
|
|
||||||
scene.widgetList={
|
scene.widgetList={
|
||||||
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
|
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.newInputBox{name='ticket', x=280, y=200,w=730,h=320,font=30,regex="[0-9A-Z]",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,regex="[0-9a-zA-Z]",limit=8},
|
WIDGET.newKey{name='authorize', x=430, y=640,w=300,h=80,font=40,code=_authorize},
|
||||||
WIDGET.newKey{name='verify', x=640, y=530,w=300,h=80,font=40,code=_codeLogin},
|
WIDGET.newKey{name='submit', x=755, y=640,w=300,h=80,font=40,code=_submit},
|
||||||
WIDGET.newKey{name='paste', x=850, y=530,w=80,font=40,fText=CHAR.icon.import,code=_paste},
|
WIDGET.newKey{name='paste', x=970, y=640,w=80,font=40,fText=CHAR.icon.import,code=_paste},
|
||||||
|
|
||||||
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ 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='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='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='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=goScene'reset_password'},
|
|
||||||
WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR',
|
WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR',
|
||||||
code=function()
|
code=function()
|
||||||
if tryBack() then
|
if tryBack() then
|
||||||
|
|||||||
Reference in New Issue
Block a user