删除密码登录场景

This commit is contained in:
ParticleG
2023-01-09 17:34:35 +08:00
parent bc634b2eeb
commit c19e656d46
13 changed files with 1 additions and 237 deletions

View File

@@ -744,17 +744,8 @@ return {
music="BGMs",
label="label",
},
login_pw={
title="Sign In",
login_mail="Login with E-mail/Sign Up",
email="Email Address",
password="Password",
showEmail="Show Email",
login="Log In",
},
login_mail={
title="Sign In/Sign Up",
login_pw="Password Sign In",
email="Email Address",
send="Send code",
code="Verification Code",

View File

@@ -736,17 +736,8 @@ return {
music="BGMs",
label="Etiq.",
},
login_pw={
title="Entrar",
login_mail="Registrarse/Pedir código",
email="Correo Elec.",
password="Contraseña",
showEmail="Mostrar Correo",
login="Entrar",
},
login_mail={
title="Entrar/Registrarse",
login_pw="Ingr. con Contraseña",
email="Correo Elec.",
send="Enviar código",
code="Código de Verif.",

View File

@@ -699,17 +699,8 @@ return {
music="Musique",
-- label="label",
},
login_pw={
title="Connexion",
-- login_mail="Login with E-mail/Sign Up",
email="E-mail",
password="Mot de passe",
-- showEmail="Show Email",
login="Connexion",
},
login_mail={
title="Connexion/Enregistrement",
-- login_pw="Password Sign In",
email="E-mail",
-- send="Send code",
-- code="Verification Code",

View File

@@ -745,17 +745,8 @@ return {
music="Musik",
label="label",
},
login_pw={
title="Masuk",
-- login_mail="Login with E-mail/Sign Up",
email="Alamat Email",
password="Password",
showEmail="Tunjukkan Email",
login="Masuk",
},
login_mail={
title="Masuk/Daftar",
-- login_pw="Password Sign In",
email="Alamat Email",
-- send="Send code",
-- code="Verification Code",

View File

@@ -746,17 +746,8 @@ return {
music="",
label="ラベル",
},
login_pw={
title="ログイン",
login_mail="アカウントを登録/パスワードを忘れた",
email="Eメールアドレス",
password="パスワード",
showEmail="Eメールアドレスを表示",
login="ログイン",
},
login_mail={
title="サインイン/サインアップ",
login_pw="パスワードでログイン",
email="Eメールアドレス",
send="認証コード送信",
code="認証コード",

View File

@@ -734,17 +734,8 @@ return {
-- music="BGMs",
-- label="label",
},
login_pw={
title="Log in",
-- login_mail="Login with E-mail/Sign Up",
email="Endereço De Email",
password="Senha",
-- showEmail="Show Email",
login="Log in",
},
login_mail={
title="Log in/Registrar",
-- login_pw="Password Sign In",
email="Endereço De Email",
-- send="Send code",
-- code="Verification Code",

View File

@@ -485,17 +485,8 @@ return {
music="~~~",
label="...",
},
login_pw={
title="Log in",
-- login_mail="Login with E-mail/Sign Up",
email="@",
password="*",
showEmail="?",
login="",
},
login_mail={
title="Log in/Sign up",
login_pw="*** →",
email="@",
send="",
code="",

View File

@@ -744,17 +744,8 @@ return {
path="打开存储目录",
save="用户档案管理",
},
login_pw={
title="登录",
login_mail="邮箱登录/注册",
email="邮箱",
password="密码",
showEmail="显示邮箱",
login="登录",
},
login_mail={
title="登录/注册",
login_pw="密码登录",
email="邮箱",
send="发送验证码",
code="验证码",

View File

@@ -693,17 +693,8 @@ return {
path="OpenPath();",
save="DataManagement();",
},
login_pw={
title="LogIn.UI",
login_mail="Login_mail_sign_up()",
email="Email=",
password="Password=",
showEmail="ShowEmail",
login="Login();",
},
login_mail={
title="LogIn_Register.UI",
login_pw="Login_pw();",
email="Email=",
send="Send();",
code="V-code=",

View File

@@ -744,17 +744,8 @@ return {
path="打開存儲目錄",
save="用戶資料管理",
},
login_pw={
title="登錄",
login_mail="電郵登錄/注册",
email="電郵",
password="密碼",
showEmail="顯示郵箱",
login="登錄",
},
login_mail={
title="登錄/註冊",
login_pw="密碼登錄",
email="電郵",
send="發送驗證碼",
code="驗證碼",

View File

@@ -266,110 +266,8 @@ function NET.autoLogin()
return
end
end
if USER.rToken then
local res=getMsg({
pool='autoLogin',
path='/techmino/api/v1/auth/refresh',
headers={["x-refresh-token"]=USER.rToken},
},6.26)
if res then
if res.code==200 then
USER.rToken=res.data.refreshToken
USER.aToken=res.data.accessToken
saveUser()
NET.ws_connect()
SCN.go('net_menu')
WAIT.interrupt()
return
end
else
WAIT.interrupt()
return
end
end
if USER.password then
local res=getMsg({
pool='pwLogin',
path='/techmino/api/v1/auth/login/email',
body={
email=USER.email,
password=USER.password,
},
},6.26)
if res then
if res.code==200 then
USER.rToken=res.data.refreshToken
USER.aToken=res.data.accessToken
saveUser()
NET.ws_connect()
SCN.go('net_menu')
WAIT.interrupt()
return
end
else
WAIT.interrupt()
end
end
SCN.go('login_pw')
WAIT.interrupt()
end)
end
function NET.pwLogin(email,pw)
if not TASK.lock('pwLogin') then return end
TASK.new(function()
WAIT{
quit=function()
TASK.unlock('pwLogin')
HTTP.deletePool('pwLogin')
end,
timeout=12.6,
}
TEST.yieldT(.26)
local salt do
local res=getMsg({
pool='pwLogin',
path='/techmino/api/v1/auth/seed/email',
body={
email=email,
},
},6.26)
if res and res.code==200 then
salt=res.data
else
WAIT.interrupt()
return
end
end
pw=HASH.pbkdf2(HASH.sha3_256,pw,salt,260)
do
local res=getMsg({
pool='pwLogin',
path='/techmino/api/v1/auth/login/email',
body={
email=email,
password=pw,
},
},6.26)
if res then
if res.code==200 then
USER.email=email
USER.password=pw
USER.rToken=res.data.refreshToken
USER.aToken=res.data.accessToken
saveUser()
NET.ws_connect()
SCN.swapTo('net_menu')
end
end
end
SCN.go('login')
WAIT.interrupt()
end)
end

View File

@@ -1,44 +0,0 @@
local emailBox=WIDGET.newInputBox{name='email',x=380,y=200,w=500,h=60,limit=128}
local passwordBox=WIDGET.newInputBox{name='password',x=380,y=300,w=620,h=60,secret=true,regex="[ -~]",limit=64}
local showEmail=true
local function _login()
local email,password=emailBox:getText(),passwordBox:getText()
if not STRING.simpEmailCheck(email) then
MES.new('error',text.wrongEmail) return
elseif #password==0 then
MES.new('error',text.noPassword) return
end
NET.pwLogin(email,password)
end
local scene={}
function scene.enter()
showEmail=false
emailBox.secret=true
emailBox:setText(USER.email)
passwordBox:setText("")
end
function scene.keyDown(key,rep)
if rep then return true end
if key=='return' then
_login()
else
return true
end
end
scene.widgetList={
WIDGET.newText{name='title', x=80, y=50,font=70,align='L'},
WIDGET.newButton{name='login_mail',x=1080,y=100,w=260,h=80,color='lY',code=function() SCN.swapTo('login_mail','swipeL') end},
emailBox,
passwordBox,
WIDGET.newSwitch{name='showEmail', x=550, y=420,disp=function() return showEmail end,code=function() showEmail=not showEmail emailBox.secret=not showEmail end},
WIDGET.newKey{name='login', x=1140,y=540,w=170,h=80,font=40,code=pressKey'return'},
WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene},
}
return scene