Browse Source

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

pull/2429/head
NGPixel 4 years ago
parent
commit
9009816290
1 changed files with 2 additions and 1 deletions
  1. 3
      server/models/users.js

3
server/models/users.js

@ -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() {

Loading…
Cancel
Save