mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:08:53 +08:00
perf: 双重验证显示secret
This commit is contained in:
@@ -48,8 +48,8 @@ export class UserTwoFactorSettingController extends BaseController {
|
||||
@Post("/authenticator/qrcode", { summary: Constants.per.authOnly })
|
||||
async authenticatorQrcode() {
|
||||
const userId = this.getUserId();
|
||||
const qrcode = await this.twoFactorService.getAuthenticatorQrCode(userId);
|
||||
return this.ok(qrcode);
|
||||
const {qrcode,link,secret} = await this.twoFactorService.getAuthenticatorQrCode(userId);
|
||||
return this.ok({qrcode,link,secret});
|
||||
}
|
||||
|
||||
@Post("/authenticator/save", { summary: Constants.per.authOnly })
|
||||
|
||||
@@ -33,7 +33,8 @@ export class TwoFactorService {
|
||||
|
||||
//生成qrcode base64
|
||||
const qrcode = await import("qrcode");
|
||||
return await qrcode.toDataURL(qrcodeContent);
|
||||
const qrcodeBase64 = await qrcode.toDataURL(qrcodeContent);
|
||||
return {qrcode:qrcodeBase64,link:qrcodeContent,secret}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user