Fix handle length checking for auth and register.
This commit is contained in:
parent
8c6a3c3993
commit
cec083ac96
@ -42,8 +42,12 @@ const SCENES = {
|
||||
|
||||
let container = document.createElement("section");
|
||||
let form = document.createElement("form");
|
||||
|
||||
let tb_handle = UI.textbox("handle", "");
|
||||
tb_handle.setAttribute("maxlength", 24);
|
||||
|
||||
form.appendChild(UI.table(null, [
|
||||
[ UI.label(LANG("handle"), "handle"), UI.textbox("handle", "") ],
|
||||
[ UI.label(LANG("handle"), "handle"), tb_handle ],
|
||||
[ UI.label(LANG("secret"), "secret"), UI.password("secret") ],
|
||||
[ UI.label(LANG("invitation"), "code"), UI.password("code") ],
|
||||
]));
|
||||
@ -64,7 +68,7 @@ const SCENES = {
|
||||
code.removeAttribute("class");
|
||||
event.target.removeAttribute("class");
|
||||
|
||||
if(handle.value.length > 0 && secret.value.length > 0 && code.value.length > 0) {
|
||||
if(handle.value.length > 0 && handle.value.length < 24 && secret.value.length > 0 && code.value.length > 0) {
|
||||
event.target.setAttribute("disabled", "");
|
||||
|
||||
let enc = new TextEncoder();
|
||||
@ -82,7 +86,7 @@ const SCENES = {
|
||||
enc_code,
|
||||
]);
|
||||
} else {
|
||||
if(handle.value.length == 0) { handle.setAttribute("class", "error"); }
|
||||
if(handle.value.length == 0 || handle.value.length > 24) { handle.setAttribute("class", "error"); }
|
||||
if(secret.value.length == 0) { secret.setAttribute("class", "error"); }
|
||||
if(code.value.length == 0) { code.setAttribute("class", "error"); }
|
||||
}
|
||||
@ -144,7 +148,7 @@ const SCENES = {
|
||||
let form = document.createElement("form");
|
||||
|
||||
let tb_handle = UI.textbox("handle", "");
|
||||
tb_handle.setAttribute("maxlength", 18);
|
||||
tb_handle.setAttribute("maxlength", 24);
|
||||
|
||||
form.appendChild(UI.table(null, [
|
||||
[ UI.label(LANG("handle"), "handle"), tb_handle ],
|
||||
@ -165,7 +169,7 @@ const SCENES = {
|
||||
secret.removeAttribute("class");
|
||||
event.target.removeAttribute("class");
|
||||
|
||||
if(handle.value.length > 0 && secret.value.length > 0) {
|
||||
if(handle.value.length > 0 && handle.value.length <= 24 && secret.value.length > 0) {
|
||||
event.target.setAttribute("disabled", "");
|
||||
|
||||
let enc = new TextEncoder();
|
||||
@ -180,7 +184,7 @@ const SCENES = {
|
||||
enc_secret,
|
||||
]);
|
||||
} else {
|
||||
if(handle.value.length == 0) { handle.setAttribute("class", "error"); }
|
||||
if(handle.value.length == 0 || handle.value.length > 24) { handle.setAttribute("class", "error"); }
|
||||
if(secret.value.length == 0) { secret.setAttribute("class", "error"); }
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user