mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-02 00:55:48 +02:00
fix issues from test deploy
This commit is contained in:
parent
3fb3be1f1e
commit
ce5df3b0b9
92 changed files with 1410 additions and 1019 deletions
|
@ -14,14 +14,22 @@ import {
|
|||
serializeResourceSessionCookie
|
||||
} from "@server/auth/resource";
|
||||
import config from "@server/config";
|
||||
import logger from "@server/logger";
|
||||
|
||||
export const authWithPasswordBodySchema = z.object({
|
||||
password: z.string()
|
||||
});
|
||||
export const authWithPasswordBodySchema = z
|
||||
.object({
|
||||
password: z.string()
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const authWithPasswordParamsSchema = z.object({
|
||||
resourceId: z.string().transform(Number).pipe(z.number().int().positive())
|
||||
});
|
||||
export const authWithPasswordParamsSchema = z
|
||||
.object({
|
||||
resourceId: z
|
||||
.string()
|
||||
.transform(Number)
|
||||
.pipe(z.number().int().positive())
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type AuthWithPasswordResponse = {
|
||||
session?: string;
|
||||
|
@ -120,10 +128,7 @@ export async function authWithPassword(
|
|||
passwordId: definedPassword.passwordId
|
||||
});
|
||||
const cookieName = `${config.server.resource_session_cookie_name}_${resource.resourceId}`;
|
||||
const cookie = serializeResourceSessionCookie(
|
||||
cookieName,
|
||||
token,
|
||||
);
|
||||
const cookie = serializeResourceSessionCookie(cookieName, token);
|
||||
res.appendHeader("Set-Cookie", cookie);
|
||||
|
||||
return response<AuthWithPasswordResponse>(res, {
|
||||
|
@ -136,6 +141,7 @@ export async function authWithPassword(
|
|||
status: HttpCode.OK
|
||||
});
|
||||
} catch (e) {
|
||||
logger.error(e);
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.INTERNAL_SERVER_ERROR,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue