Repository navigation
feat(azure): let the dashboard change member numbers and choose the new address #70
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
Open
viganogabriele
wants to merge
7
commits into
main
Choose a base branch
from
feat/azure-member-number
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8ad6729
feat(azure): let the dashboard change member numbers and choose the n…
viganogabriele 40e8231
fix(emails): sign as Team Lead IT and offer it@polinetwork.org as a c…
viganogabriele 9fd2fee
fix(azure): serialize member writes and keep notification addresses o…
viganogabriele 77129b6
fix(azure): handle directory lag, mail failures and incomplete member…
viganogabriele 538b1dd
chore: merge main into feat/azure-member-number
viganogabriele 9379c13
test(azure): make the incomplete-account reservation test order-indep…
viganogabriele 29a39f1
test(esign): start the service clock at the current time
viganogabriele File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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,14 @@ | ||
| import type { MemberSummary } from "./types" | ||
|
|
||
| export class IncompleteMemberError extends Error { | ||
| constructor( | ||
| readonly member: MemberSummary, | ||
| cause: unknown | ||
| ) { | ||
| super( | ||
| `Account ${member.mail} (${member.id}) was created, but setup and cleanup failed. Contact IT before trying again.`, | ||
| { cause } | ||
| ) | ||
| this.name = "IncompleteMemberError" | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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,35 @@ | ||
| import z from "zod" | ||
|
|
||
| export const MAIL_DOMAIN = "polinetwork.org" | ||
|
|
||
| const LOCAL_PART = /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/ | ||
|
|
||
| /** The part before `@polinetwork.org`: lowercase letters, digits, and single dots or hyphens between them. */ | ||
| export const localPartSchema = z | ||
| .string() | ||
| .trim() | ||
| .toLowerCase() | ||
| .max(64) | ||
| .regex(LOCAL_PART, "Only lowercase letters, digits, dots and hyphens") | ||
|
|
||
| export const mailboxSchema = z.discriminatedUnion("kind", [ | ||
| z.object({ kind: z.literal("standard") }), | ||
| z.object({ kind: z.literal("custom"), localPart: localPartSchema }), | ||
| ]) | ||
|
|
||
| export type MailboxChoice = z.infer<typeof mailboxSchema> | ||
|
|
||
| /** Accents and apostrophes are dropped and spaces removed: "Niccolò", "D'Amico" -> "niccolo.damico". */ | ||
| function namePart(name: string) { | ||
| return name.normalize("NFD").replace(/\p{M}/gu, "").replace(/['\s]/g, "").toLowerCase() | ||
| } | ||
|
|
||
| /** `firstname.lastname`, or null when the name has letters an address cannot hold (e.g. "Łukasz"). */ | ||
| export function standardLocalPart(firstName: string, lastName: string): string | null { | ||
| const localPart = `${namePart(firstName)}.${namePart(lastName)}` | ||
| return LOCAL_PART.test(localPart) && localPart.length <= 64 ? localPart : null | ||
| } | ||
|
|
||
| export function mailboxLocalPart(firstName: string, lastName: string, mailbox: MailboxChoice) { | ||
| return mailbox.kind === "custom" ? mailbox.localPart : standardLocalPart(firstName, lastName) | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.