Feat/onboarding username (#3580)
* fix: remove duplicate button in textusernamefield * feat: adds username if not present in getting-started first onboarding step * fix: credentials * fix: typo * fix: user type * fix: type errors * Validates successRedirectUrl earlier with zod * Removes deprecated api endpoint * Reduces the data needed for the frontend on onboarding Co-authored-by: Agusti Fernandez Pardo <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Omar López <[email protected]>
This commit is contained in:
8 files changed
+135
-177
No files matched your search
@@ -75,6 +75,7 @@ model EventType {
|
||||
currency String @default("usd")
|
||||
slotInterval Int?
|
||||
metadata Json?
|
||||
/// @zod.custom(imports.successRedirectUrl)
|
||||
successRedirectUrl String?
|
||||
workflows WorkflowsOnEventTypes[]
|
||||
|
||||
|
||||
@@ -111,3 +111,23 @@ export const userMetadata = z
|
||||
intentUsername: z.string().optional(),
|
||||
})
|
||||
.nullable();
|
||||
|
||||
/**
|
||||
* Ensures that it is a valid HTTP URL
|
||||
* It automatically avoids
|
||||
* - XSS attempts through javascript:alert('hi')
|
||||
* - mailto: links
|
||||
*/
|
||||
export function assertValidUrl(url: string | null | undefined) {
|
||||
if (!url) return false;
|
||||
return url.startsWith("http://") && url.startsWith("https://");
|
||||
}
|
||||
|
||||
export const successRedirectUrl = z
|
||||
.string()
|
||||
.url()
|
||||
.refine(assertValidUrl, {
|
||||
path: ["successRedirectUrl"],
|
||||
message: "Invalid URL",
|
||||
})
|
||||
.nullish();
|
||||
Reference in new issue
Block a user