added issuer and label to qr code

This commit is contained in:
alex-phillips 2020-02-26 10:56:50 -05:00
parent e5251b604f
commit bee07eb72c

View File

@ -138,7 +138,13 @@ router.put('/:id', upload.single('avatar'), async (req, res, next) => {
// Begin process to set up and confirm multi-factor authentication
if (user.multifactorEnabled === false && !!req.body.multifactorEnabled === true) {
const secret = Speakeasy.generateSecret({ length: 10 })
const qrcode = await QRCode.toDataURL(secret.otpauth_url, { scale: 6 })
const url = Speakeasy.otpauthURL({
secret: secret.base32,
encoding: 'base32',
issuer: 'Heimdall',
label: user.username
})
const qrcode = await QRCode.toDataURL(url, { scale: 6 })
user.update({
totpSecret: secret.base32