mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-29 01:28:59 -05:00
feat: change totp issuer to display logo in 2FAS app
This commit is contained in:
parent
bbfc9d6f14
commit
e0fbbeca3c
1 changed files with 1 additions and 4 deletions
|
@ -8,7 +8,6 @@ import { User } from "@prisma/client";
|
||||||
import * as argon from "argon2";
|
import * as argon from "argon2";
|
||||||
import { authenticator, totp } from "otplib";
|
import { authenticator, totp } from "otplib";
|
||||||
import * as qrcode from "qrcode-svg";
|
import * as qrcode from "qrcode-svg";
|
||||||
import { ConfigService } from "src/config/config.service";
|
|
||||||
import { PrismaService } from "src/prisma/prisma.service";
|
import { PrismaService } from "src/prisma/prisma.service";
|
||||||
import { AuthService } from "./auth.service";
|
import { AuthService } from "./auth.service";
|
||||||
import { AuthSignInTotpDTO } from "./dto/authSignInTotp.dto";
|
import { AuthSignInTotpDTO } from "./dto/authSignInTotp.dto";
|
||||||
|
@ -18,7 +17,6 @@ export class AuthTotpService {
|
||||||
constructor(
|
constructor(
|
||||||
private prisma: PrismaService,
|
private prisma: PrismaService,
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
private config: ConfigService,
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async signInTotp(dto: AuthSignInTotpDTO) {
|
async signInTotp(dto: AuthSignInTotpDTO) {
|
||||||
|
@ -78,12 +76,11 @@ export class AuthTotpService {
|
||||||
throw new BadRequestException("TOTP is already enabled");
|
throw new BadRequestException("TOTP is already enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Maybe make the issuer configurable with env vars?
|
|
||||||
const secret = authenticator.generateSecret();
|
const secret = authenticator.generateSecret();
|
||||||
|
|
||||||
const otpURL = totp.keyuri(
|
const otpURL = totp.keyuri(
|
||||||
user.username || user.email,
|
user.username || user.email,
|
||||||
this.config.get("general.appName"),
|
"pingvin-share",
|
||||||
secret,
|
secret,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue