注册功能初步完成

This commit is contained in:
MrZ626
2020-11-07 01:04:18 +08:00
parent b2dcbcdbd7
commit e08aeef6cb
7 changed files with 61 additions and 21 deletions

View File

@@ -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()