Add player bug reports and profile identity features
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { glowColorSchema } from "./profile-appearance";
|
||||
|
||||
export const displayNameSchema = z
|
||||
.string()
|
||||
@@ -38,8 +39,15 @@ export const authActionSchema = z.discriminatedUnion("action", [
|
||||
z.object({ action: z.literal("recover"), email }).strict(),
|
||||
]);
|
||||
export const profileUpdateSchema = z
|
||||
.object({ displayName: displayNameSchema })
|
||||
.strict();
|
||||
.object({
|
||||
displayName: displayNameSchema.optional(),
|
||||
glowColor: glowColorSchema.optional(),
|
||||
})
|
||||
.strict()
|
||||
.refine(
|
||||
(value) => value.displayName !== undefined || value.glowColor !== undefined,
|
||||
"Choose a profile change",
|
||||
);
|
||||
export const initialPasswordSchema = z
|
||||
.object({ password: newPasswordSchema })
|
||||
.strict();
|
||||
@@ -61,10 +69,12 @@ export function authDestination(value: string | null | undefined): string {
|
||||
value === "/settings" ||
|
||||
value === "/dashboard" ||
|
||||
value === "/servers" ||
|
||||
value === "/support" ||
|
||||
value === "/auth/reset-password"
|
||||
)
|
||||
return value;
|
||||
if (value && /^\/dashboard\/[0-9a-f-]{36}$/i.test(value)) return value;
|
||||
if (value && /^\/support\/[0-9a-f-]{36}$/i.test(value)) return value;
|
||||
if (value && /^\/pair\?code=[A-F0-9]{8}$/.test(value)) return value;
|
||||
return "/dashboard";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user