diff --git a/js/settings/FormPanel.js b/js/settings/FormPanel.js
index a1a0b0d..64420e2 100644
--- a/js/settings/FormPanel.js
+++ b/js/settings/FormPanel.js
@@ -120,8 +120,7 @@ function FormPanel() {
validated = false;
}
});
- settings.substituted_ssid = data.substituted_ssid;
- if(complete) complete(validated);
+ if(complete) complete(validated, data);
}, function() {
console.log("Settings:saveSettings: failed");
clearTimeout(_retrySaveSettingsDelay);
diff --git a/js/settings/NetworkPanel.js b/js/settings/NetworkPanel.js
index 3b709ab..63f2e2c 100644
--- a/js/settings/NetworkPanel.js
+++ b/js/settings/NetworkPanel.js
@@ -24,6 +24,7 @@ function NetworkPanel() {
var _networks = {};
var _currentNetwork; // the ssid of the network the box is on
var _selectedNetwork; // the ssid of the selected network in the client mode settings
+ var _substituted_ssid; // the substituted ssid (displayed during creation)
var _currentLocalIP = "";
var _currentAP;
var _currentNetworkStatus;
@@ -295,7 +296,7 @@ function NetworkPanel() {
break;
case NetworkAPI.STATUS.CREATING:
_btnCreate.attr("disabled", true);
- msg = "Creating access point... Reconnect by connecting your device to "+settings.substituted_ssid+" and going to draw.doodle3d.com";
+ msg = "Creating access point... Reconnect by connecting your device to "+_substituted_ssid+" and going to draw.doodle3d.com";
break;
}
//console.log(" ap display msg: ",msg);
@@ -306,7 +307,7 @@ function NetworkPanel() {
//console.log("NetworkPanel:connectToNetwork");
if(_selectedNetwork == undefined) return;
// save network related settings and on complete, connect to network
- _form.saveSettings(_form.readForm(),function(validated) {
+ _form.saveSettings(_form.readForm(),function(validated, data) {
if(!validated) return;
updateClientModeUI(NetworkAPI.STATUS.CONNECTING,"");
_api.associate(_selectedNetwork,_passwordField.val(),true);
@@ -321,8 +322,9 @@ function NetworkPanel() {
this.createAP = function() {
//console.log("createAP");
// save network related settings and on complete, create access point
- _form.saveSettings(_form.readForm(),function(success) {
- if(!success) return;
+ _form.saveSettings(_form.readForm(),function(validated, data) {
+ if(!validated) return;
+ _substituted_ssid = data.substituted_ssid;
updateAPModeUI(NetworkAPI.STATUS.CREATING,"");
_api.openAP();
diff --git a/js/settings/SettingsWindow.js b/js/settings/SettingsWindow.js
index 98c61fc..6639830 100644
--- a/js/settings/SettingsWindow.js
+++ b/js/settings/SettingsWindow.js
@@ -108,8 +108,10 @@ function SettingsWindow() {
_btnOK.attr("disabled",true);
e.preventDefault();
e.stopPropagation();
- _form.saveSettings(_form.readForm(),function(success){
- if(success) {
+ var newSettings = _form.readForm();
+ _form.saveSettings(newSettings,function(validated, data){
+ if(validated) {
+ settings = newSettings; // store new settings in global settings
settingsPopup.close();
self.signin();
}
@@ -128,14 +130,6 @@ function SettingsWindow() {
_networkPanel.update();
};
- this.saveSettings = function(newSettings,complete) {
- settings = newSettings; // store new settings in global settings
- _form.saveSettings(newSettings,function(validated) {
- //TODO: settings.substituted_ssid = data.substituted_ssid;
- if(complete) complete(validated);
- });
- };
-
this.resetSettings = function() {
console.log("resetSettings");
self.btnRestoreSettings.attr("disabled", true);