split in env required and dynamic values
This commit is contained in:
parent
f32143b7ac
commit
730c25a9a1
35 changed files with 491 additions and 198 deletions
|
@ -11,10 +11,10 @@ import {
|
|||
} from "../../../command/management/user/userCommand";
|
||||
import UserCommandHandler from "../../../command/management/user/userCommandHandler";
|
||||
import MailHelper from "../../../helpers/mailHelper";
|
||||
import { CLUB_NAME } from "../../../env.defaults";
|
||||
import { UpdateUserPermissionsCommand } from "../../../command/management/user/userPermissionCommand";
|
||||
import UserPermissionCommandHandler from "../../../command/management/user/userPermissionCommandHandler";
|
||||
import BadRequestException from "../../../exceptions/badRequestException";
|
||||
import SettingHelper from "../../../helpers/settingsHelper";
|
||||
|
||||
/**
|
||||
* @description get All users
|
||||
|
@ -157,7 +157,7 @@ export async function deleteUser(req: Request, res: Response): Promise<any> {
|
|||
// 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")}`,
|
||||
`Ihr Nutzerkonto des Adminportals wurde erfolgreich gelöscht.`
|
||||
);
|
||||
} catch (error) {}
|
||||
|
|
|
@ -12,8 +12,8 @@ import WebapiCommandHandler from "../../../command/management/webapi/webapiComma
|
|||
import { UpdateWebapiPermissionsCommand } from "../../../command/management/webapi/webapiPermissionCommand";
|
||||
import WebapiPermissionCommandHandler from "../../../command/management/webapi/webapiPermissionCommandHandler";
|
||||
import { JWTHelper } from "../../../helpers/jwtHelper";
|
||||
import { CLUB_NAME } from "../../../env.defaults";
|
||||
import { StringHelper } from "../../../helpers/stringHelper";
|
||||
import SettingHelper from "../../../helpers/settingsHelper";
|
||||
|
||||
/**
|
||||
* @description get All apis
|
||||
|
@ -78,7 +78,7 @@ export async function createWebapi(req: Request, res: Response): Promise<any> {
|
|||
|
||||
let token = await JWTHelper.create(
|
||||
{
|
||||
iss: CLUB_NAME,
|
||||
iss: SettingHelper.getSetting("club.name") as string,
|
||||
sub: "api_token_retrieve",
|
||||
aud: StringHelper.random(32),
|
||||
},
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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";
|
||||
|
@ -12,12 +11,9 @@ import ResetCommandHandler from "../command/resetCommandHandler";
|
|||
import MailHelper from "../helpers/mailHelper";
|
||||
import ResetService from "../service/resetService";
|
||||
import UserService from "../service/management/userService";
|
||||
import { CLUB_NAME } from "../env.defaults";
|
||||
import PermissionHelper from "../helpers/permissionHelper";
|
||||
import RolePermissionService from "../service/management/rolePermissionService";
|
||||
import UserPermissionService from "../service/management/userPermissionService";
|
||||
import { UpdateUserSecretCommand } from "../command/management/user/userCommand";
|
||||
import UserCommandHandler from "../command/management/user/userCommandHandler";
|
||||
import SettingHelper from "../helpers/settingsHelper";
|
||||
|
||||
/**
|
||||
* @description request totp reset
|
||||
|
@ -31,7 +27,7 @@ export async function startReset(req: Request, res: Response): Promise<any> {
|
|||
|
||||
let { mail } = await UserService.getByUsername(username);
|
||||
|
||||
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 createReset: CreateResetCommand = {
|
||||
username: username,
|
||||
|
@ -43,7 +39,7 @@ export async function startReset(req: Request, res: Response): Promise<any> {
|
|||
// 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}/reset/reset?mail=${mail}&token=${token}`
|
||||
);
|
||||
|
||||
|
@ -62,7 +58,7 @@ export async function verifyReset(req: Request, res: Response): Promise<any> {
|
|||
|
||||
let { secret } = await ResetService.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) => {
|
||||
|
|
|
@ -2,12 +2,12 @@ import { Request, Response } from "express";
|
|||
import speakeasy from "speakeasy";
|
||||
import QRCode from "qrcode";
|
||||
import InternalException from "../exceptions/internalException";
|
||||
import { CLUB_NAME } from "../env.defaults";
|
||||
import UserService from "../service/management/userService";
|
||||
import UserFactory from "../factory/admin/management/user";
|
||||
import { TransferUserOwnerCommand, UpdateUserCommand } from "../command/management/user/userCommand";
|
||||
import UserCommandHandler from "../command/management/user/userCommandHandler";
|
||||
import ForbiddenRequestException from "../exceptions/forbiddenRequestException";
|
||||
import SettingHelper from "../helpers/settingsHelper";
|
||||
|
||||
/**
|
||||
* @description get my by id
|
||||
|
@ -33,7 +33,7 @@ export async function getMyTotp(req: Request, res: Response): Promise<any> {
|
|||
|
||||
let { secret } = await UserService.getById(userId);
|
||||
|
||||
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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue