diff --git a/Site/Controls/v5/Base/AjaxToggleSlider.ascx b/Site/Controls/v5/Base/AjaxToggleSlider.ascx
index ca6b84b5..a60723e1 100644
--- a/Site/Controls/v5/Base/AjaxToggleSlider.ascx
+++ b/Site/Controls/v5/Base/AjaxToggleSlider.ascx
@@ -6,6 +6,8 @@
$(document).ready(function () {
+ alertify.log("Initialize <%=this.Cookie%>");
+
$('#<%=this.ClientID%>_sliderContainer').toggles(
{
on: <%= this.InitialValue.ToString().ToLower() %>,
@@ -16,12 +18,11 @@
off: SwarmopsJS.unescape('<%= this.Localized_SwitchLabelOff_Upper %>')
}
})
- .on('toggle', function(e, active)
- {
+ .on('toggle', function(e, active) {
+ alertify.log("Toggle: <%=this.Cookie%> " + active);
+
if (active != _initVal_<%=this.SliderCheckbox.ClientID%>) {
- var jsonData = {};
- jsonData.newValue = active;
- jsonData.cookie = '<%=this.Cookie%>';
+ alertify.log("Change detect");
// The AJAX call expects the following function prototype:
//
@@ -34,6 +35,10 @@
if ("" != "<%=this.AjaxCallbackUrl%>") { // if there's a direct callback AJAX url
+ var jsonData = {};
+ jsonData.newValue = active;
+ jsonData.cookie = '<%=this.Cookie%>';
+
SwarmopsJS.ajaxCall(
"<%=this.AjaxCallbackUrl%>",
jsonData,
@@ -80,6 +85,7 @@
} else {
// if there's no AJAX callback URL given, the javascript handler must take care of it
// Resharper marks this code as unused because it falsely thinks the if condition above is always true
+ alertify.log("Calling <%=this.OnChange%>()");
_initVal_<%=this.SliderCheckbox.ClientID%> = active;
<%=this.OnChange%> (active, '<%=this.Cookie%>', '<%=this.ClientID%>'); // JavaScript callback on successful change
}
@@ -98,12 +104,12 @@
}
function <%=this.ClientID%>_setValue(newValue) {
- $('#<%=this.ClientID%>_sliderContainer').toggles({ on: newValue });
+ $('#<%=this.ClientID%>_sliderContainer').toggles({ on: newValue }, true, true);
}
function <%=this.ClientID%>_initialize(initValue) {
_initVal_<%=this.SliderCheckbox.ClientID%> = initValue;
- $('#<%=this.ClientID%>_sliderContainer').toggles({ on: initValue });
+ $('#<%=this.ClientID%>_sliderContainer').toggles({ on: initValue }, true, true);
<%=this.ClientID%>_enable();
}
diff --git a/Site/Master-v5.master b/Site/Master-v5.master
index 6c79600a..e718fb92 100644
--- a/Site/Master-v5.master
+++ b/Site/Master-v5.master
@@ -250,7 +250,7 @@
-
+
@@ -266,7 +266,7 @@
PERSONNAME:
-
+
@@ -485,7 +485,7 @@
<%= this.MasterEditPersonPhone.ClientID %>_initialize(data.Phone);
<%= this.MasterEditPersonTwitterId.ClientID %>_initialize(data.TwitterId);
- <%= this.MasterEditPerson2FA.ClientID%>_initialize(data.TwoFactorActive);
+
<%= this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(data.TwoFactorActive);
_master_PersonEditLoading = false;
@@ -508,12 +508,12 @@
// (the AjaxToggleSlider auto-callback is disabled for this reason)
- alert("Field Change: " + fieldName + " changed to '" + newValue + "'");
+ alertify.log("Field Change: " + fieldName + " changed to '" + newValue + "'");
}
function masterPersonEditor2FAToggle(newValue, fieldName, controlName) {
- alert("2FA Field Change: " + fieldName + " changed to '" + newValue + "'");
+ alertify.log("2FA Field Change: " + fieldName + " changed to '" + newValue + "'");
if (newValue) // this is a boolean, so "== true" is implicit
{
<%= this.ModalMasterEnableBitId.ClientID %>_open();
@@ -523,11 +523,11 @@
function masterPersonEditor2FAProvisionToggle(newValue, fieldName, controlName) {
- alert("2FA Provisioning Field Change: " + fieldName + " changed to '" + newValue + "'");
+ alertify.log("2FA Provisioning Field Change: " + fieldName + " changed to '" + newValue + "'");
if (newValue) { // it's a boolean, so "if true" meaning if the slider is "on"
// 2FA can't be provisioned true, only installed by the user
- <%= this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(false);
+ setTimeout(function() { <%= this.MasterEditPerson2FAProvisioning.ClientID %>_initialize(false); }, 500);
alertify.alert(SwarmopsJS.unescape('<%=this.Localized_MasterPersonEdit_CannotProvision2FA%>'));
} else {
alertify.confirm(SwarmopsJS.unescape('<%=this.Localized_MasterPersonEdit_ConfirmRemove2FAProvision%>'),
diff --git a/Site/Master-v5.master.designer.cs b/Site/Master-v5.master.designer.cs
index f328813c..cf468e07 100644
--- a/Site/Master-v5.master.designer.cs
+++ b/Site/Master-v5.master.designer.cs
@@ -381,15 +381,6 @@ namespace Swarmops.Frontend {
///
protected global::Swarmops.Frontend.Controls.Base.AjaxTextBox MasterEditPersonCurrentPassword;
- ///
- /// MasterEditPerson2FA control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::Swarmops.Frontend.Controls.Base.AjaxToggleSlider MasterEditPerson2FA;
-
///
/// MasterEditPersonNewPassword1 control.
///