QR's can't alwasy be created
This commit is contained in:
parent
401d0a10b1
commit
6953cdf159
|
@ -107,18 +107,22 @@ function validateAndConsumeBackupCode(user, token, cb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createQRCode(otp, options, secret) {
|
function createQRCode(otp, options, secret) {
|
||||||
const uri = otp.keyuri(options.username || 'user', Config().general.boardName, secret);
|
try {
|
||||||
const qrCode = qrGen(0, 'L');
|
const uri = otp.keyuri(options.username || 'user', Config().general.boardName, secret);
|
||||||
qrCode.addData(uri);
|
const qrCode = qrGen(0, 'L');
|
||||||
qrCode.make();
|
qrCode.addData(uri);
|
||||||
|
qrCode.make();
|
||||||
|
|
||||||
options.qrType = options.qrType || 'ascii';
|
options.qrType = options.qrType || 'ascii';
|
||||||
return {
|
return {
|
||||||
ascii : qrCode.createASCII,
|
ascii : qrCode.createASCII,
|
||||||
data : qrCode.createDataURL,
|
data : qrCode.createDataURL,
|
||||||
img : qrCode.createImgTag,
|
img : qrCode.createImgTag,
|
||||||
svg : qrCode.createSvgTag,
|
svg : qrCode.createSvgTag,
|
||||||
}[options.qrType]();
|
}[options.qrType]();
|
||||||
|
} catch(e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareOTP(otpType, options, cb) {
|
function prepareOTP(otpType, options, cb) {
|
||||||
|
|
Loading…
Reference in New Issue