注册功能初步完成
This commit is contained in:
@@ -7,24 +7,27 @@ function keyDown.login(key)
|
||||
local password2=WIDGET.active.password2.value
|
||||
if #username==0 then
|
||||
LOG.print(text.noUsername)return
|
||||
elseif not email:match("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$")then
|
||||
elseif not email:match("^[a-zA-Z0-9_]+@[a-zA-Z0-9_-]+%.[a-zA-Z0-9_]+$")then
|
||||
LOG.print(text.wrongEmail)return
|
||||
elseif #code~=12 then
|
||||
LOG.print(text.wrongCode)return
|
||||
elseif #password==0 or #password2==0 then
|
||||
LOG.print(text.noPassword)return
|
||||
elseif password~=password2 then
|
||||
LOG.print(text.diffPassword)return
|
||||
end
|
||||
local data=urlencode.encode({
|
||||
username=username,
|
||||
email=email,
|
||||
password=password,
|
||||
code=code,
|
||||
})
|
||||
httpRequest(
|
||||
TICK.httpREQ_register,
|
||||
"api/account/register",
|
||||
"POST",
|
||||
{["Content-Type"]="application/json"},
|
||||
json.encode({
|
||||
username=username,
|
||||
email=email,
|
||||
password=password,
|
||||
code=code,
|
||||
})
|
||||
{["Content-Type"]="application/x-www-form-urlencoded"},
|
||||
data
|
||||
)
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
|
||||
@@ -35,7 +35,7 @@ end
|
||||
|
||||
WIDGET.init("main",{
|
||||
WIDGET.newButton({name="offline", x=150,y=220,w=200,h=140,color="lRed", font=40,code=WIDGET.lnk.goScene("mode")}),
|
||||
WIDGET.newButton({name="online", x=370,y=220,w=200,h=140,color="lCyan", font=40,code=WIDGET.lnk.goScene(LOGIN and"netgame"or"login"),hide=function()return not LOGIN end}),
|
||||
WIDGET.newButton({name="online", x=370,y=220,w=200,h=140,color="lCyan", font=40,code=WIDGET.lnk.goScene(LOGIN and"netgame"or"login")}),
|
||||
WIDGET.newButton({name="custom", x=590,y=220,w=200,h=140,color="lBlue", font=45,code=WIDGET.lnk.goScene("customGame"),hide=function()return not RANKS.marathon_normal end}),
|
||||
WIDGET.newButton({name="setting", x=150,y=380,w=200,h=140,color="lOrange",font=40,code=WIDGET.lnk.goScene("setting_game")}),
|
||||
WIDGET.newButton({name="stat", x=370,y=380,w=200,h=140,color="lGreen", font=35,code=WIDGET.lnk.goScene("stat")}),
|
||||
|
||||
Reference in New Issue
Block a user