gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchf4-homesplit07d1717c|||PR ident#40 home.hl is split into components, one per area: email step, identity form, identity list, app identity choice, time zone; each moves its faces with it, the email step is shared with embed.hl (#40.3, rest of #40.2)mref4-homesplit/components/codestep.hl

2.3 KB

  1. // components/codestep.hl — THE CODE STEP of the sign-in (ident#40.2): the one-time-code form, placed by components/home.hl (the code page)
  2. // and components/embed.hl (the selector's frame). The host passes in WHO the code was sent to (sentTo) and the sentence's ending (tail);
  3. // this component owns the code field, the browser's time zone and the check against the server (face verifyCode, lib/login.hl
  4. // signInWithCode). What follows is the host's: it gets the answer through $parent.codeVerified(r) or $parent.codeFailed(text), and
  5. // "Other address" is $parent.back(). Markup, ids and look are those both pages had before (the CSS is components/styles.hl).
  6. import { signInWithCode } from '../lib/login.hl'
  7. sentTo = ''
  8. tail = '.'
  9. code = ''
  10. View {
  11. p { id = "sentto" class = "lead" "We sent a six-digit code to " strong { sentTo } tail }
  12. form { id = "codeform"
  13. on submit(e) {
  14. e.preventDefault()
  15. emit verify(e)
  16. }
  17. label { "One-time code"
  18. input { id = "code" name = "code" autocomplete = "one-time-code" inputmode = "numeric" pattern = "[0-9]{6}" maxlength = "6" required = "required" value = code on input(e) { emit setCode(e.target.value) } }
  19. }
  20. formButtons {
  21. button { id = "verify" type = "submit" "Sign in" }
  22. button { id = "back" type = "button" class = "quiet" "Other address" on click(e) { $parent.back() } }
  23. }
  24. }
  25. }
  26. on setCode(v) { code = v }
  27. // the browser's own time zone (IANA name) goes with the first login (`Intl` is a browser global of client code, hybriel#18)
  28. browserZone = () => { return Intl.DateTimeFormat().resolvedOptions().timeZone }
  29. on verify(e) {
  30. $parent.codeFailed('')
  31. r = emit server verifyCode(sentTo, code, browserZone())
  32. if (r == null) {
  33. $parent.codeFailed('the server did not answer — try again')
  34. return null
  35. }
  36. if (r.error != null) {
  37. $parent.codeFailed(r.error)
  38. return null
  39. }
  40. $parent.codeVerified(r)
  41. }
  42. // the right code signs the session in; the first one for an address creates the account, its default identity and stores the
  43. // browser's time zone
  44. on server verifyCode(email, code, timeZone, session) {
  45. if (session == null) { return { error = 'no session — reload the page' } }
  46. if (email == null || hlTypeName(email) != 'String' || code == null || hlTypeName(code) != 'String') { return { error = 'email and code must be strings' } }
  47. return signInWithCode(&session, email, code, timeZone)
  48. }

Branches

Latest commits

  • 07d1717c|||PR ident#40 home.hl is split into components, one per area: email step, identity form, identity list, app identity choice, time zone; each moves its faces with it, the email step is shared with embed.hl (#40.3, rest of #40.2)mre
  • 59e8fcc1ident#40.3: the app's identity choice is one component (components/chooseidentity.hl); its face chooseIdentity moves with itmre
  • e23efdfcident#40.3: the identity list is one component (components/identitylist.hl); its delete and face dropIdentity move with itmre
  • e24b59a6ident#40.3: the time zone is one component (components/timezone.hl); its face changeTimeZone moves with itmre
  • 8cbc5717ident#40.3: the email step is one component (components/emailstep.hl) placed by home.hl and embed.hlmre
  • 6fad3bd2Merge branch 'f3-codestep' into mainIdent
  • 51e387f2|||PR ident#40 the code step is one component (components/codestep.hl) placed by home.hl and embed.hl; its verify face, setCode, browserZone and verify call exist once (#40.2)mre
  • c28bddeeMerge branch 'f2-shell' into mainIdent
  • c3a40ff6|||PR ident#40 one shell for the app and /start (account part off on /start, #40.1); startshell.hl removed; unused signOut faces gone (#40.4)mre
  • 060f3870ident#40.4: use the shell sign-out faces in regression gatesmre
  • 9b94aa6aMerge branch 'f1b-cleanup' into mainIdent
  • edcfce3f|||PR ident#41 ident#43 ident#44 login error page as a component (same status codes and text, pixel-identical), declarations and route wiring cleaned upmre
  • 3ac85995ident#43 ident#44: plain declarations for never-reassigned lets, one envString helper, named route functions and audience rule out of project.hlmre
  • c7eef14aMerge branch 'nv1-navigate' into mainIdent
  • 644f9775|||PR ident#36 navigate() instead of window.location in the shell, start shell and homemre
  • 4ca2f921deploy.sh: tar --hard-dereference so backups hold no hard linksmre
  • 23971fb7ident#49: media queries in the language's @media formmre
  • 73f4f97dident: re-vendor to hybriel day38b (mpackdb store-open fix)mre
  • aa056c03ident: a startup error prints its message before exit 1 (hybriel#247)mre
  • ee37a861ident#G48: gitoria's registration gets the wildcard origin of its repo addresses at load (gate tests/gitoria-origin.mjs)mre