-
-
Notifications
You must be signed in to change notification settings - Fork 10
Feature/atcoder verified voting #3319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Changes from all commits
0080b3b
e9ea7a0
833d928
0ad162f
1c5681e
a8ca83c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||||||||||||||
| <script lang="ts"> | ||||||||||||||||||||||
| import { untrack } from 'svelte'; | ||||||||||||||||||||||
| import { Label, Input, P } from 'flowbite-svelte'; | ||||||||||||||||||||||
| import ClipboardCopy from '@lucide/svelte/icons/clipboard-copy'; | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -40,12 +41,11 @@ | |||||||||||||||||||||
| status: string; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| let { | ||||||||||||||||||||||
| username = $bindable(), | ||||||||||||||||||||||
| atcoder_username = $bindable(), | ||||||||||||||||||||||
| atcoder_validationcode = $bindable(), | ||||||||||||||||||||||
| status, | ||||||||||||||||||||||
| }: Props = $props(); | ||||||||||||||||||||||
| let { username, atcoder_username, atcoder_validationcode, status }: Props = $props(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Editable only in 'nothing' step; server is authoritative after each action. | ||||||||||||||||||||||
| // untrack: prop is the initial seed only — intentional one-time capture. | ||||||||||||||||||||||
| let editableAtcoderId = $state(untrack(() => atcoder_username)); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
||||||||||||||||||||||
| // Keep editableAtcoderId in sync with server after a reset: | |
| // when the server clears atcoder_username and status returns to 'nothing', | |
| // reset the local editable value as well. | |
| $effect(() => { | |
| if (status === 'nothing' && atcoder_username === '') { | |
| editableAtcoderId = ''; | |
| } | |
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The verification check conflates “user is not AtCoder-verified” with “
locals.useris missing”. Sincelocals.useris populated inhooks.server.tsby looking up the DB user, a deleted/missing user could yieldlocals.user === undefinedeven whensessionis valid; returning 403 with an AtCoder-verification message would be misleading. Consider explicitly handling!locals.user(e.g., treat it as UNAUTHORIZED/INTERNAL_SERVER_ERROR) and only return FORBIDDEN when the user exists butis_validatedis false.