split in env required and dynamic values

This commit is contained in:
Julian Krauser 2025-04-19 16:51:37 +02:00
parent f32143b7ac
commit 730c25a9a1
35 changed files with 491 additions and 198 deletions

View file

@ -1,6 +1,5 @@
import { Request, Response } from "express";
import { JWTHelper } from "../helpers/jwtHelper";
import { JWTToken } from "../type/jwtTypes";
import InternalException from "../exceptions/internalException";
import RefreshCommandHandler from "../command/refreshCommandHandler";
import { CreateRefreshCommand } from "../command/refreshCommand";
@ -15,10 +14,8 @@ import MailHelper from "../helpers/mailHelper";
import InviteService from "../service/management/inviteService";
import UserService from "../service/management/userService";
import CustomRequestException from "../exceptions/customRequestException";
import { CLUB_NAME } from "../env.defaults";
import { CreateUserPermissionCommand } from "../command/management/user/userPermissionCommand";
import UserPermissionCommandHandler from "../command/management/user/userPermissionCommandHandler";
import InviteFactory from "../factory/admin/management/invite";
import SettingHelper from "../helpers/settingsHelper";
/**
* @description get all invites
@ -59,7 +56,7 @@ export async function inviteUser(req: Request, res: Response, isInvite: boolean
throw new CustomRequestException(409, "Username and Mail are already in use");
}
var secret = speakeasy.generateSecret({ length: 20, name: `FF Admin ${CLUB_NAME}` });
var secret = speakeasy.generateSecret({ length: 20, name: `FF Admin ${SettingHelper.getSetting("club.name")}` });
let createInvite: CreateInviteCommand = {
username: username,
@ -73,7 +70,7 @@ export async function inviteUser(req: Request, res: Response, isInvite: boolean
// sendmail
await MailHelper.sendMail(
mail,
`Email Bestätigung für Mitglieder Admin-Portal von ${CLUB_NAME}`,
`Email Bestätigung für Mitglieder Admin-Portal von ${SettingHelper.getSetting("club.name")}`,
`Öffne folgenden Link: ${origin}/${isInvite ? "invite" : "setup"}/verify?mail=${mail}&token=${token}`
);
@ -92,7 +89,7 @@ export async function verifyInvite(req: Request, res: Response): Promise<any> {
let { secret, username } = await InviteService.getByMailAndToken(mail, token);
const url = `otpauth://totp/FF Admin ${CLUB_NAME}?secret=${secret}`;
const url = `otpauth://totp/FF Admin ${SettingHelper.getSetting("club.name")}?secret=${secret}`;
QRCode.toDataURL(url)
.then((result) => {