PHP8
[Pman.BAdmin] / Pman.Dialog.BAdminPassword.js
index 1d0af23..2d099ce 100644 (file)
@@ -269,10 +269,27 @@ Roo.apply(Pman.Dialog.BAdminPassword.prototype, {
                 },
                click : function (_self, e)
                 {
+                    if(!Pman.Login.authUser) {
+                        Roo.bootstrap.MessageBox.alert('Error', 'Please login again');
+                        return;
+                    }
+                    
                     e.preventDefault();
                     
                     if(!this.checked) {
-                        Pman.Dialog.BAdminStaffTwoFactorQRCode.show({}, function(){_this.dialog.hide({})});
+                        Pman.Dialog.BAdminStaffTwoFactorQRCode.show({
+                            id: Pman.Login.authUser.id,
+                            allow_close: false,
+                            allow_cancel : true
+                        }, function(valid){
+                                if(valid) {
+                                    _this.dialog.hide({});
+                                    return;
+                                }
+                                
+                                _this.form.findField('_enable_oath_key').setChecked(false,false);
+                            }
+                        );
                         return;
                     }
                     
@@ -283,6 +300,7 @@ Roo.apply(Pman.Dialog.BAdminPassword.prototype, {
                             oath_key_disable: 1,
                             id: Pman.Login.authUser.id
                         },
+                        
                         success : function(res)
                         {
                             switch(res.data) {
@@ -294,6 +312,7 @@ Roo.apply(Pman.Dialog.BAdminPassword.prototype, {
                                     break;
                             }
                         },
+                        
                         failure : function(res)
                         {
                             Roo.bootstrap.MessageBox.alert('Error', res);