enhance: Display TOTP Register URL
Close #7261 Co-Authored-By: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
@ -2,8 +2,8 @@ import bcrypt from 'bcryptjs';
|
||||
import * as speakeasy from 'speakeasy';
|
||||
import * as QRCode from 'qrcode';
|
||||
import config from '@/config/index.js';
|
||||
import define from '../../../define.js';
|
||||
import { UserProfiles } from '@/models/index.js';
|
||||
import define from '../../../define.js';
|
||||
|
||||
export const meta = {
|
||||
requireCredential: true,
|
||||
@ -40,15 +40,17 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
});
|
||||
|
||||
// Get the data URL of the authenticator URL
|
||||
const dataUrl = await QRCode.toDataURL(speakeasy.otpauthURL({
|
||||
const url = speakeasy.otpauthURL({
|
||||
secret: secret.base32,
|
||||
encoding: 'base32',
|
||||
label: user.username,
|
||||
issuer: config.host,
|
||||
}));
|
||||
});
|
||||
const dataUrl = await QRCode.toDataURL(url);
|
||||
|
||||
return {
|
||||
qr: dataUrl,
|
||||
url,
|
||||
secret: secret.base32,
|
||||
label: user.username,
|
||||
issuer: config.host,
|
||||
|
Reference in New Issue
Block a user