登录界面添加登录按钮
This commit is contained in:
@@ -477,6 +477,7 @@ return{
|
|||||||
register="Sign up",
|
register="Sign up",
|
||||||
email="Email address",
|
email="Email address",
|
||||||
password="Password",
|
password="Password",
|
||||||
|
login="Log in",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Sign up",
|
title="Sign up",
|
||||||
|
|||||||
@@ -474,6 +474,7 @@ return{
|
|||||||
register="Enregistrement",
|
register="Enregistrement",
|
||||||
email="E-mail",
|
email="E-mail",
|
||||||
password="Mot de passe",
|
password="Mot de passe",
|
||||||
|
login="Connexion",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Enregistrement",
|
title="Enregistrement",
|
||||||
|
|||||||
@@ -479,6 +479,7 @@ return{
|
|||||||
register="Registrarse",
|
register="Registrarse",
|
||||||
email="Correo Elec.",
|
email="Correo Elec.",
|
||||||
password="Contraseña",
|
password="Contraseña",
|
||||||
|
login="Entrar",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Registrarse",
|
title="Registrarse",
|
||||||
|
|||||||
@@ -397,6 +397,7 @@ return{
|
|||||||
register="Sign up",
|
register="Sign up",
|
||||||
email="@",
|
email="@",
|
||||||
password="*",
|
password="*",
|
||||||
|
login="Log in",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="Sign up",
|
title="Sign up",
|
||||||
|
|||||||
@@ -500,6 +500,7 @@ return{
|
|||||||
register="注册",
|
register="注册",
|
||||||
email="邮箱",
|
email="邮箱",
|
||||||
password="密码",
|
password="密码",
|
||||||
|
login="登录",
|
||||||
},
|
},
|
||||||
register={
|
register={
|
||||||
title="注册",
|
title="注册",
|
||||||
|
|||||||
@@ -1,25 +1,27 @@
|
|||||||
local scene={}
|
local scene={}
|
||||||
|
|
||||||
|
function login()
|
||||||
|
local email= WIDGET.active.email.value
|
||||||
|
local password= WIDGET.active.password.value
|
||||||
|
if #email==0 or not email:match("^[a-zA-Z0-9_]+@[a-zA-Z0-9_-]+%.[a-zA-Z0-9_]+$") then
|
||||||
|
LOG.print(text.wrongEmail)return
|
||||||
|
elseif #password==0 then
|
||||||
|
LOG.print(text.noPassword)return
|
||||||
|
end
|
||||||
|
httpRequest(
|
||||||
|
TICK.httpREQ_newLogin,
|
||||||
|
PATH.api..PATH.auth,
|
||||||
|
"GET",
|
||||||
|
{["Content-Type"]="application/json"},
|
||||||
|
json.encode{
|
||||||
|
email=email,
|
||||||
|
password=password,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
if key=="return"then
|
if key=="escape"then
|
||||||
local email= WIDGET.active.email.value
|
|
||||||
local password= WIDGET.active.password.value
|
|
||||||
if #email==0 or not email:match("^[a-zA-Z0-9_]+@[a-zA-Z0-9_-]+%.[a-zA-Z0-9_]+$") then
|
|
||||||
LOG.print(text.wrongEmail)return
|
|
||||||
elseif #password==0 then
|
|
||||||
LOG.print(text.noPassword)return
|
|
||||||
end
|
|
||||||
httpRequest(
|
|
||||||
TICK.httpREQ_newLogin,
|
|
||||||
PATH.api..PATH.auth,
|
|
||||||
"GET",
|
|
||||||
{["Content-Type"]="application/json"},
|
|
||||||
json.encode{
|
|
||||||
email=email,
|
|
||||||
password=password,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
elseif key=="escape"then
|
|
||||||
SCN.back()
|
SCN.back()
|
||||||
else
|
else
|
||||||
WIDGET.keyPressed(key)
|
WIDGET.keyPressed(key)
|
||||||
@@ -31,6 +33,7 @@ scene.widgetList={
|
|||||||
WIDGET.newButton{name="register", x=1140, y=100,w=170,h=80,color="green",code=function()SCN.swapTo("register","swipeR")end},
|
WIDGET.newButton{name="register", x=1140, y=100,w=170,h=80,color="green",code=function()SCN.swapTo("register","swipeR")end},
|
||||||
WIDGET.newTextBox{name="email", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z@._-]"},
|
WIDGET.newTextBox{name="email", x=380, y=200,w=500,h=60,regex="[0-9A-Za-z@._-]"},
|
||||||
WIDGET.newTextBox{name="password", x=380, y=300,w=626,h=60,secret=true,regex="[ -~]"},
|
WIDGET.newTextBox{name="password", x=380, y=300,w=626,h=60,secret=true,regex="[ -~]"},
|
||||||
|
WIDGET.newKey{name="login", x=1140, y=540,w=170,h=80,font=40,code=login},
|
||||||
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
|
WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,font=40,code=WIDGET.lnk_BACK},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user