check : function (_self, checked)
{
if(checked) {
-
this.setBoxLabel('Untick to disable Two Factor authentication');
-
return;
}
},
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;
}
new Pman.Request({
- url : baseURL + '/Roo/core_person',
- method :'POST',
+ url : baseURL + '/Roo/Core_person',
+ method :'GET',
params : {
- id : record.data.id,
- active: record.data.active
-
+ oath_key_disable: 1,
+ id: Pman.Login.authUser.id
},
- success : function()
- {
- },
- failure : function()
+ success : function(res)
{
+ switch(res.data) {
+ case 'DONE':
+ Roo.bootstrap.MessageBox.alert('Success', 'The two factor authentication has been disabled');
+ break;
+ default:
+ Roo.log('invalid usage');
+ break;
+ }
+ },
+ failure : function(res)
+ {
+ Roo.bootstrap.MessageBox.alert('Error', res);
}
});
}