fix: 2fa qr code - handle special chars in site title

This commit is contained in:
NGPixel 2020-09-09 20:10:51 -04:00
parent aa96e97028
commit 9009816290

View File

@ -128,7 +128,8 @@ module.exports = class User extends Model {
tfaIsActive: false,
tfaSecret: tfaInfo.secret
})
return qr.imageSync(`otpauth://totp/${WIKI.config.title}:${this.email}?secret=${tfaInfo.secret}`, { type: 'svg' })
const safeTitle = WIKI.config.title.replace(/[\s-.,=!@#$%?&*()+[\]{}/\\;<>]/g, '')
return qr.imageSync(`otpauth://totp/${safeTitle}:${this.email}?secret=${tfaInfo.secret}`, { type: 'svg' })
}
async enableTFA() {