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:
authored and GitHub committed 2022-08-01 15:44:08 -06:00
1 parent 54acf6d28f
commit c1896fc833
8 files changed
+135 -177

No files matched your search

+1
View File
@@ -75,6 +75,7 @@ model EventType {
currency String @default("usd")
slotInterval Int?
metadata Json?
/// @zod.custom(imports.successRedirectUrl)
successRedirectUrl String?
workflows WorkflowsOnEventTypes[]
+20
View File
@@ -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();