diff --git a/ismism.ts/cli/dbset.ts b/ismism.ts/cli/dbset.ts index 0688eb0..f475ae3 100644 --- a/ismism.ts/cli/dbset.ts +++ b/ismism.ts/cli/dbset.ts @@ -1,7 +1,7 @@ import { db } from "../src/db.ts" import { act_c } from "../src/eid/act.ts" import { aut_c } from "../src/eid/aut.ts" -import { usr_c } from "../src/eid/usr.ts" +import { usr_c, usr_u } from "../src/eid/usr.ts" await db("ismism", true) @@ -10,7 +10,7 @@ const actid = [ `ismism${Math.round(Math.random() * 1000000)}`, ] -await Promise.all([ +const [uid1] = await Promise.all([ usr_c("11111111111", [1, 2], "江苏", "苏州"), act_c({ _id: actid[0], @@ -19,8 +19,8 @@ await Promise.all([ }), aut_c({ _id: 1, p: ["pre_usr", "pro_usr", "pro_soc", "pro_agd"] }) ]) -await Promise.all([ - usr_c("222222222222", [1, 2], "江苏", "苏州"), +const [uid2] = await Promise.all([ + usr_c("11111111112", [1, 2], "江苏", "苏州"), act_c({ _id: actid[1], exp: new Date("2023-06-31").getTime(), @@ -28,5 +28,11 @@ await Promise.all([ }), aut_c({ _id: 2, p: ["pre_usr", "pro_usr", "pro_soc", "pro_agd"] }) ]) +await Promise.all([ + usr_u(uid1!, { $set: { nam: "未明子" } }), + usr_u(uid1!, { $unset: { nbr: "" } }), + usr_u(uid2!, { $set: { nam: "张正午" } }), + usr_u(uid2!, { $unset: { nbr: "" } }), +]) -console.log(actid) +console.log([uid1, uid2], actid) diff --git a/ismism.ts/ui/bind.ts b/ismism.ts/ui/bind.ts index 3813458..84e2c8a 100644 --- a/ismism.ts/ui/bind.ts +++ b/ismism.ts/ui/bind.ts @@ -1,4 +1,5 @@ // deno-lint-ignore-file no-window-prefix +import { not_nbr } from "../src/ont/sms.ts" import { utc_medium } from "../src/ont/utc.ts" import type { Pas } from "../src/pra/pas.ts" import type { PasCode, UsrAct } from "../src/pra/pos.ts" @@ -29,12 +30,12 @@ const main = document.getElementById("main")! function paspre( ) { - const [pas_t, [ + const [paspre_t, [ nbr_e, send_e, pre_e, actid_e, act_e, pas_e, code_e, issue_e, hint_e, - ]] = bind("pas", [ + ]] = bind("paspre", [ "nbr", "send", "pre", "actid", "act", "pas", "code", "issue", @@ -47,7 +48,7 @@ function paspre( ]] const send = async () => { - if (!nbr_e.checkValidity()) { alert("无效手机号"); return } + if (!/^1\d{10}$/.test(nbr_e.value)) { alert("无效手机号"); return } nbr_e.readOnly = send_e.disabled = true const sent = await pos("pas", { nbr: nbr_e.value, sms: location.hostname === "ismist.cn" }) if (sent) { @@ -82,11 +83,11 @@ function paspre( const pas_a = document.getElementById("pas")! as HTMLAnchorElement pas_a.innerText = p.nam pas_a.href = `#${p.id.uid}` - window.location.hash = pas_a.href + window.location.hash = `#${p.id.uid}` }) }) - main.append(pas_t) + main.append(paspre_t) } window.addEventListener("hashchange", () => {