Show server auth policy limits in client auth UI
This commit is contained in:
@@ -70,7 +70,7 @@ type MessageHandlerDeps = {
|
||||
playLocateToneAt: (x: number, y: number) => void;
|
||||
resolveIncomingSoundUrl: (url: string) => string;
|
||||
playIncomingItemUseSound: (url: string, x: number, y: number) => void;
|
||||
handleAuthRequired: (message: string) => void;
|
||||
handleAuthRequired: (message: Extract<IncomingMessage, { type: 'auth_required' }>) => void;
|
||||
handleAuthResult: (message: Extract<IncomingMessage, { type: 'auth_result' }>) => Promise<void>;
|
||||
};
|
||||
|
||||
@@ -81,7 +81,7 @@ export function createOnMessageHandler(deps: MessageHandlerDeps): (message: Inco
|
||||
return async function onMessage(message: IncomingMessage): Promise<void> {
|
||||
switch (message.type) {
|
||||
case 'auth_required':
|
||||
deps.handleAuthRequired(message.message);
|
||||
deps.handleAuthRequired(message);
|
||||
break;
|
||||
|
||||
case 'auth_result':
|
||||
|
||||
@@ -54,6 +54,14 @@ export const welcomeMessageSchema = z.object({
|
||||
userId: z.string().nullable().optional(),
|
||||
username: z.string().nullable().optional(),
|
||||
role: z.string().nullable().optional(),
|
||||
policy: z
|
||||
.object({
|
||||
usernameMinLength: z.number().int().positive(),
|
||||
usernameMaxLength: z.number().int().positive(),
|
||||
passwordMinLength: z.number().int().positive(),
|
||||
passwordMaxLength: z.number().int().positive(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.optional(),
|
||||
uiDefinitions: z
|
||||
@@ -96,6 +104,14 @@ export const welcomeMessageSchema = z.object({
|
||||
export const authRequiredSchema = z.object({
|
||||
type: z.literal('auth_required'),
|
||||
message: z.string(),
|
||||
authPolicy: z
|
||||
.object({
|
||||
usernameMinLength: z.number().int().positive(),
|
||||
usernameMaxLength: z.number().int().positive(),
|
||||
passwordMinLength: z.number().int().positive(),
|
||||
passwordMaxLength: z.number().int().positive(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const authResultSchema = z.object({
|
||||
@@ -106,6 +122,14 @@ export const authResultSchema = z.object({
|
||||
username: z.string().optional(),
|
||||
role: z.string().optional(),
|
||||
nickname: z.string().optional(),
|
||||
authPolicy: z
|
||||
.object({
|
||||
usernameMinLength: z.number().int().positive(),
|
||||
usernameMaxLength: z.number().int().positive(),
|
||||
passwordMinLength: z.number().int().positive(),
|
||||
passwordMaxLength: z.number().int().positive(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export const signalMessageSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user