Skip to content

Commit

Permalink
fix: 2fa qr code - handle special chars in site title
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Sep 10, 2020
1 parent aa96e97 commit 9009816
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/models/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 9009816

Please sign in to comment.