mirror of
https://github.com/kind-0/nsecbunkerd.git
synced 2025-03-17 13:22:54 +01:00
fix
This commit is contained in:
parent
c28e58de88
commit
f3b8aa8ebb
@ -174,10 +174,13 @@ class Daemon {
|
||||
async startWebAuth() {
|
||||
if (!this.config.authPort) return;
|
||||
|
||||
const prefix = new URL(this.config.baseUrl as string).pathname.replace(/\/+$/, '');
|
||||
|
||||
this.fastify.register(FastifyView, {
|
||||
engine: {
|
||||
handlebars: Handlebars
|
||||
}
|
||||
},
|
||||
prefix
|
||||
});
|
||||
|
||||
this.fastify.listen({ port: this.config.authPort });
|
||||
|
@ -49,8 +49,6 @@ export async function authorizeRequestWebHandler(request, reply) {
|
||||
const record = await getAndValidateStateOfRequest(request);
|
||||
const url = new URL(request.url, `http://${request.headers.host}`);
|
||||
const callbackUrl = url.searchParams.get("callbackUrl");
|
||||
console.log(request)
|
||||
const baseUrl = new URL(request.originalUrl).pathname.replace(/\/+$/, '');
|
||||
|
||||
const method = record.method;
|
||||
let nip05: string | undefined;
|
||||
@ -61,7 +59,7 @@ export async function authorizeRequestWebHandler(request, reply) {
|
||||
const [ username, domain, email ] = JSON.parse(record.params!);
|
||||
nip05 = `${username}@${domain}`;
|
||||
|
||||
return reply.view("/templates/createAccount.handlebar", { baseUrl, record, email, username, domain, nip05, callbackUrl });
|
||||
return reply.view("/templates/createAccount.handlebar", { record, email, username, domain, nip05, callbackUrl });
|
||||
} else {
|
||||
const authorized = validateAuthCookie(request);
|
||||
return reply.view("/templates/authorizeRequest.handlebar", { record, callbackUrl, authorized });
|
||||
@ -165,8 +163,6 @@ export async function processRegistrationWebHandler(request, reply) {
|
||||
try {
|
||||
const record = await getAndValidateStateOfRequest(request);
|
||||
const body = request.body;
|
||||
console.log(request)
|
||||
const baseUrl = new URL(request.originalUrl).pathname.replace(/\/+$/, '');
|
||||
|
||||
// we serialize the payload again and store it
|
||||
// along with the allowed flag
|
||||
@ -183,7 +179,7 @@ export async function processRegistrationWebHandler(request, reply) {
|
||||
const [ username, domain, email ] = JSON.parse(record.params!);
|
||||
const nip05 = `${username}@${domain}`;
|
||||
|
||||
return reply.view("/templates/createAccount.handlebar", { baseUrl, record, email, username, domain, nip05, error: e.message});
|
||||
return reply.view("/templates/createAccount.handlebar", { record, email, username, domain, nip05, error: e.message});
|
||||
}
|
||||
|
||||
await prisma.request.update({
|
||||
|
@ -87,7 +87,7 @@
|
||||
</h1>
|
||||
</div>
|
||||
<form
|
||||
action="{{baseUrl}}/register/{{record.id}}"
|
||||
action="/register/{{record.id}}"
|
||||
method="POST"
|
||||
class="w-full flex flex-col gap-5">
|
||||
{{#if error}}
|
||||
|
@ -52,7 +52,7 @@
|
||||
</h1>
|
||||
</div>
|
||||
<form
|
||||
action="{{baseUrl}}/login"
|
||||
action="/login"
|
||||
method="POST"
|
||||
class="w-full flex flex-col gap-5">
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user