Skip to content

Commit afeaaf4

Browse files
committed
Fixes #215
1 parent ed9f84e commit afeaaf4

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

assets/js/ezxss4.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const EzXSS = {
248248
}
249249

250250
// 2FA QR code
251-
if (document.getElementById("qrcode")) {
251+
if (document.getElementById("qrcode") && document.getElementById("secret")) {
252252
this.initializeQRCode();
253253
}
254254
},
@@ -428,21 +428,25 @@ const EzXSS = {
428428
$('.method-content').hide();
429429
$('#method-pick').hide();
430430

431-
const alertId = parseInt(this.value);
432-
Utils.request('/manage/account/getAlertStatus', { alertId })
433-
.then((data) => {
434-
if (data.enabled === 1) {
435-
$(`#method-content-${alertId}`).show();
436-
} else {
437-
$('#method-disabled').show();
438-
}
439-
});
431+
if(this.value) {
432+
const alertId = parseInt(this.value);
433+
Utils.request('/manage/account/getAlertStatus', { alertId })
434+
.then((data) => {
435+
if (data.enabled === 1) {
436+
$(`#method-content-${alertId}`).show();
437+
} else {
438+
$('#method-disabled').show();
439+
}
440+
});
441+
}
440442
},
441443

442444
handleCommonDataChange() {
443-
const id = this.value;
444-
const row = this.id === 'pick_common1' ? 1 : 2;
445-
EzXSS.pickCommon(id, row, EzXSS.state.isAdmin);
445+
if(this.value) {
446+
const id = this.value;
447+
const row = this.id === 'pick_common1' ? 1 : 2;
448+
EzXSS.pickCommon(id, row, EzXSS.state.isAdmin);
449+
}
446450
},
447451

448452
handleItemRemoval() {

0 commit comments

Comments
 (0)