library-ts/node/users/handlers/_/confirm-signup.ts

32 lines
866 B
TypeScript
Raw Normal View History

2025-11-11 21:46:18 +00:00
import { CryptIO } from "../../../crypt/CryptIO";
import { RJLog } from "../../../log/RJLog";
import { RequestHandler, RequestType } from "../../RequestHandler";
2025-11-10 17:41:48 +00:00
import { FastifyRequest, FastifyReply } from 'fastify';
export class ConfirmSignUpHandler extends RequestHandler
{
static url = "/confirm-signup";
constructor(){ super( RequestType.GET, ConfirmSignUpHandler.url ); }
async _handle( request:FastifyRequest, reply:FastifyReply )
{
const { id, token } = request.query as { id?: string; token?: string };
if ( ! id || ! token )
{
return this.sendError( "Missing id or token" );
}
let result = await this.userDB.confirmUserSignUp( id, token, this.ip );
if ( ! result )
{
2025-11-15 18:58:30 +00:00
return this.sendError( "User signup confirmation failed" );
2025-11-10 17:41:48 +00:00
}
return this.sendInfo( "User creation confirmed" );
}
}