mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-14 01:59:05 +03:00
This is the one.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import mockApi from "./mock-api";
|
||||
import assert from "assert";
|
||||
import db from "../db/db";
|
||||
import ResetDBState from "./reset-db-state";
|
||||
import CreateLogCtx from "../logger";
|
||||
|
||||
const logger = CreateLogCtx("fake-session.ts");
|
||||
|
||||
export async function CreateFakeAuthCookie() {
|
||||
await ResetDBState();
|
||||
// possible security issue, ask hazel
|
||||
let res = await mockApi.post("/internal-api/auth/login").send({
|
||||
username: "test_zkldi",
|
||||
password: "password",
|
||||
captcha: "asdf",
|
||||
});
|
||||
|
||||
if (res.status !== 200) {
|
||||
logger.crit("Failed to login. Cannot generate auth cookie.");
|
||||
throw res.body;
|
||||
}
|
||||
|
||||
return res.headers["set-cookie"] as string[];
|
||||
}
|
||||
|
||||
export async function DestroyFakeAuthToken(cookie: string) {
|
||||
// stub
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"username": "zkldi",
|
||||
"usernameLowercase": "zkldi",
|
||||
"password": "$2y$12$u2FK6QJAv/WDF/ExGUWI9OoIks8Q0ExT1qjPMBu6zCZ5z72swQ01K",
|
||||
"username": "test_zkldi",
|
||||
"usernameLowercase": "test_zkldi",
|
||||
"password": "$2b$12$QRFCAxvFoNI2spszFPgt/e.qLy55GvYWlSHioa0AujRbFpChLwHmu",
|
||||
"email": "thepasswordis@password.com",
|
||||
"id": 1,
|
||||
"settings": {
|
||||
|
||||
Reference in New Issue
Block a user