-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- backend - add ResearchGroup model with 6-digit code for users to use when signing up - add checkdigit dependency to add checksum to code - TODO: maybe make the code the id? otherwise have to modify user sign up logic - TODO: exclude leading 0s to ensure it remains 6 digits even if converted to an int? - admin frontend - TODO add research groups tab (or maybe add the table to the users tab?) - TODO users tab: add button on user to create research group, allow to filter users by research group - frontend - add ResearchCodeInput input which checks the entered code checksum is valid - WIP add optional code input to user signup, remove role selection - WIP can add code in url to send sign up links to users with code pre-filled (make route /signup?) - add cdigit dependency to validate codes - resolves #185
- Loading branch information
Showing
17 changed files
with
322 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
frontend/src/lib/components/DataInput/ResearchCodeInput.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<svelte:options runes={true} /> | ||
|
||
<script lang="ts"> | ||
import { verhoeff } from "cdigit"; | ||
import { Input } from "flowbite-svelte"; | ||
import { | ||
CheckCircleOutline, | ||
ExclamationCircleOutline, | ||
} from "flowbite-svelte-icons"; | ||
let { | ||
value = $bindable(""), | ||
valid = $bindable(false), | ||
}: { | ||
value: string; | ||
valid: boolean; | ||
} = $props(); | ||
function validate(event: Event) { | ||
const target = event.target as HTMLInputElement; | ||
valid = | ||
target.value === "" || | ||
(target.value.length === 6 && verhoeff.validate(target.value)); | ||
} | ||
</script> | ||
|
||
<div class="flex flex-row items-center"> | ||
<Input type="text" bind:value class="mr-2" oninput={validate} color={valid ? 'green' : 'red'}/> | ||
{#if valid} | ||
<CheckCircleOutline color="green"/> | ||
{:else} | ||
<ExclamationCircleOutline color="red"/> | ||
{/if} | ||
</div> |
Oops, something went wrong.