implemented register and login function

This commit is contained in:
Particle_G
2020-11-24 02:18:35 +08:00
committed by MrZ626
parent 9265101025
commit 8f2b62ccc0
15 changed files with 106 additions and 52 deletions

View File

@@ -116,7 +116,7 @@ function Tmr.load()
LOADED=true
SFX.play("welcome_sfx")
VOC.play("welcome_voc")
httpRequest(TICK.httpREQ_launch,"api/game")
httpRequest(TICK.httpREQ_launch,"/tech/api/v1/app/info")
end
if S.tar then
S.cur=S.cur+1

View File

@@ -7,15 +7,19 @@ function keyDown.login(key)
elseif #password==0 then
LOG.print(text.noPassword)return
end
local data=urlencode.encode{
local success,data=json.encode({
username=username,
password=password,
}
})
if not success then
LOG.print(text.jsonError,"warn")
return
end
httpRequest(
TICK.httpREQ_register,
"api/account/register",
"POST",
{["Content-Type"]="application/x-www-form-urlencoded"},
TICK.httpREQ_login,
"/tech/api/v1/users",
"GET",
{["Content-Type"]="application/json"},
data
)
elseif key=="escape"then

View File

@@ -24,7 +24,7 @@ function Pnt.main()
gc.draw(IMG.title_color,60,30,nil,1.3)
setFont(30)
gc.print(SYSTEM,610,50)
gc.print(VERSION,610,90)
gc.print(VERSION_NAME,610,90)
gc.print(sceneTemp.tip,50,660)
local L=text.modes[STAT.lastPlay]
setFont(25)

View File

@@ -13,16 +13,20 @@ function keyDown.register(key)
elseif password~=password2 then
LOG.print(text.diffPassword)return
end
local data=urlencode.encode{
local success,data=json.encode({
username=username,
email=email,
password=password,
}
})
if not success then
LOG.print(text.jsonError,"warn")
return
end
httpRequest(
TICK.httpREQ_register,
"api/account/register",
"/tech/api/v1/users",
"POST",
{["Content-Type"]="application/x-www-form-urlencoded"},
{["Content-Type"]="application/json"},
data
)
elseif key=="escape"then