Peserta umum tanpa akun: kode akses per pelatihan (ADR 015) #2

Closed
cola wants to merge 0 commits from feat/peserta-umum-kode-akses into master
Owner

Ringkasan

Hanya ASN yang mempunyai akun. Masyarakat umum mendaftar ke satu pelatihan
bersasaran umum dari halaman prospektus publik /pelatihan/:id, duduk lewat
aturan enrollment yang sama dengan peserta berakun, dan menerima kode
akses
SINAU-XXXXX-XXXXX (tampil sekali, dikirim ke email bila server mail
dikonfigurasi). Kode ditukar di /masuk-kode menjadi sesi berperan guest
yang hanya membuka pelatihan itu. Pendaftaran mandiri /signup menjadi khusus
ASN dengan NIP wajib.

Empat commit, fast-forward di atas master:

  1. Konfigurasi mail keluar dan verifikasi email saat pendaftaran (port dari
    feat/katalog-sasaran-dan-pencarian, migrasi 045 dan 046).
  2. Catatan sesi BKN Sharing Session langsung (dokumen).
  3. trainings.audience (asn | umum, migrasi 047), pilihan "Sasaran" di
    form pelatihan, dan prospektus publik membawanya. Bagi peserta berakun ini
    label; bagi masyarakat umum ini gerbang.
  4. Peserta umum dengan kode akses (migrasi 048, ADR 015).

Keputusan desain yang perlu dibaca

  • Satu baris participants per pendaftaran tamu, bukan per email: kode
    adalah satu-satunya kredensial dan email tidak diverifikasi, sehingga
    identitas per email akan membocorkan pelatihan lain milik korban.
  • participant.ForActor menjadi satu-satunya tempat token menjadi peserta;
    Role.Learns() menggantikan setiap perbandingan == RoleParticipant yang
    bermakna "learner". Lima di antaranya sebelumnya bermakna "pengelola"
    karena eliminasi dan akan memberi tamu draft, kunci jawaban kuis, dan hak
    menerbitkan sertifikat.
  • Kirim ulang kode hanya meminta email dan mengirim ulang semua kode atas
    email itu dalam satu pesan.
  • Kode 50 bit, hash SHA-256 di guest_access; tukar kode dibatasi 20 per 15
    menit per klien. Konsekuensi dan alternatif ada di ADR 015.

Verifikasi

  • make check hijau (layout, toolchain, version, vet + golangci-lint + go
    test, eslint + tsc + vitest + build).
  • DB baru dari migrasi 001 sampai 048, lalu alur curl: daftar publik membawa
    sasaran; entri ASN menolak pendaftaran tamu (404); duplikat 409 tanpa kode;
    kode acak-acakan diterima; tamu 403 di katalog, dashboard, dan pelatihan
    lain; signup dengan type ditolak 400; kirim ulang 204; Drop mencabut kode.
  • Belum dilihat di browser: tampilan /umum, form tamu di /pelatihan/:id,
    dan GuestShell hanya terverifikasi lewat tes Vitest dan build.

🤖 Generated with Claude Code

## Ringkasan Hanya ASN yang mempunyai akun. Masyarakat umum mendaftar ke satu pelatihan bersasaran umum dari halaman prospektus publik `/pelatihan/:id`, duduk lewat aturan enrollment yang sama dengan peserta berakun, dan menerima **kode akses** `SINAU-XXXXX-XXXXX` (tampil sekali, dikirim ke email bila server mail dikonfigurasi). Kode ditukar di `/masuk-kode` menjadi sesi berperan `guest` yang hanya membuka pelatihan itu. Pendaftaran mandiri `/signup` menjadi khusus ASN dengan NIP wajib. Empat commit, fast-forward di atas `master`: 1. Konfigurasi mail keluar dan verifikasi email saat pendaftaran (port dari `feat/katalog-sasaran-dan-pencarian`, migrasi 045 dan 046). 2. Catatan sesi BKN Sharing Session langsung (dokumen). 3. `trainings.audience` (`asn` | `umum`, migrasi 047), pilihan "Sasaran" di form pelatihan, dan prospektus publik membawanya. Bagi peserta berakun ini label; bagi masyarakat umum ini gerbang. 4. Peserta umum dengan kode akses (migrasi 048, ADR 015). ## Keputusan desain yang perlu dibaca - **Satu baris `participants` per pendaftaran tamu**, bukan per email: kode adalah satu-satunya kredensial dan email tidak diverifikasi, sehingga identitas per email akan membocorkan pelatihan lain milik korban. - `participant.ForActor` menjadi satu-satunya tempat token menjadi peserta; `Role.Learns()` menggantikan setiap perbandingan `== RoleParticipant` yang bermakna "learner". Lima di antaranya sebelumnya bermakna "pengelola" karena eliminasi dan akan memberi tamu draft, kunci jawaban kuis, dan hak menerbitkan sertifikat. - Kirim ulang kode hanya meminta email dan mengirim ulang semua kode atas email itu dalam satu pesan. - Kode 50 bit, hash SHA-256 di `guest_access`; tukar kode dibatasi 20 per 15 menit per klien. Konsekuensi dan alternatif ada di ADR 015. ## Verifikasi - `make check` hijau (layout, toolchain, version, vet + golangci-lint + go test, eslint + tsc + vitest + build). - DB baru dari migrasi 001 sampai 048, lalu alur curl: daftar publik membawa sasaran; entri ASN menolak pendaftaran tamu (404); duplikat 409 tanpa kode; kode acak-acakan diterima; tamu 403 di katalog, dashboard, dan pelatihan lain; signup dengan `type` ditolak 400; kirim ulang 204; Drop mencabut kode. - Belum dilihat di browser: tampilan `/umum`, form tamu di `/pelatihan/:id`, dan `GuestShell` hanya terverifikasi lewat tes Vitest dan build. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The instansi's mail account belongs to the admins, not to whoever deploys
the binary, so the SMTP server moves out of the environment and onto a new
Pengaturan page. One singleton row holds host, port, encryption mode,
credentials, and sender; the password is AES-256-GCM under
SETTINGS_ENCRYPTION_KEY, the one secret that stays in the environment, and
the API only ever reports that a password is on file. A test message stamps
the configuration as proven, and every save clears that stamp, because a
test proved the previous settings. A mail server's refusal comes back as
502 with the server's own words, which is what an admin needs to fix a
provider's settings.

On top of that, self sign-up can now require email verification. It is an
admin switch, not a constant: it can only be enabled after a test message
succeeded, and deleting the configuration takes the requirement with it,
so a requirement nobody can satisfy is unreachable. While it is on, an
account is born inactive with its password set and a verify_email token,
the link is mailed, and opening it activates the account and signs the
holder in. activation_tokens gains a purpose column so an admin's
set_password link and a registrant's verify_email link cannot be redeemed
as each other. Login answers "email not verified" only once the password
matched, so a stranger learns nothing from it.

Ported from feat/katalog-sasaran-dan-pencarian (7ee59dc) onto master: the
migrations are renumbered 045 and 046 because 031 and 032 were taken by the
glossary, and the Checkbox primitive the settings page uses comes along
since the catalogue work that introduced it is not being ported.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Notes from attending SS 57 on 2026-09-10 with the portal open, answering
the questions the 2026-09-08 instruction left: the questionnaire and the
daftar hadir are one chained wizard, what identity fields it asks for, that
attendance is switched on by hand during the session and BKN's own register
stays open until 23:00, and that the certificate is self-served but gated
only on "did this NIP attend", not "are you this NIP". Also what a live Q&A
publishes under askers' full names. Each finding closes with what it means
for SINAU's evaluation, windows, and certificate rule.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
trainings.audience ('asn' | 'umum', migration 047) states who a catalogue
entry is for. Two values and not three: 'umum' already means open to
everyone, ASN included, so an entry open to both needs no value of its own.
The create and edit forms ask for it beside the enrollment mode, the public
prospectus carries it, and an omitted value is ASN — the column's default
and what every row carried before.

For account holders this is a label: enrolling from the catalogue reads
none of it. It exists now because the public's registration without an
account (the commit that follows) needs one fact about an entry — may
someone without an account take this — and this is that fact.

The narrow half of feat/katalog-sasaran-dan-pencarian's dff9d54, rewritten
against master's shapes; the catalogue filter bar and the shell search from
that commit are deliberately left behind.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
feat: let the public join a training with an access code instead of an account
All checks were successful
check / check (pull_request) Successful in 22m1s
b41ee72d17
Only ASN hold accounts from here on (ADR 015). A member of the public
registers for one entry addressed to umum from its public prospectus, is
seated through the same enrollment rules an account holder meets, and
receives a short access code — shown once, emailed when a mail server is
configured — that exchanges for a guest session confined to that one
training. Sign-up becomes ASN-only with the NIP mandatory.

A guest is a participants row with no users row behind it, one row per
registration on purpose: the code is the only credential and the email is
unverified, so a shared identity per email would let a stranger reach a
victim's other trainings. participant.ForActor is now the one place a token
becomes a participant, and Role.Learns() replaces every comparison against
the participant role that used to mean "learner" — several of those meant
"manager" by elimination and would have handed a guest drafts, quiz answers,
and certificate issuance.

Recovering a lost code asks for the email alone and resends every code
registered under it, because a layperson knows neither a training's id nor,
often, its name.

Ported from feat/katalog-sasaran-dan-pencarian (67fd8b9) onto master. What
an entry promises is read from publictraining's prospectus — which gains a
List and carries the audience — rather than a second catalogue of guest's
own; the registration form is mounted on /pelatihan/:id when the entry is
addressed to umum; the guest frame is chosen by AdaptiveShell alongside the
portal's; the migration is 048 and the ADR 015.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
cola closed this pull request 2026-09-17 15:59:58 +07:00
All checks were successful
check / check (pull_request) Successful in 22m1s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cola/LMS!2
No description provided.