Skip to content

Commit efa194f

Browse files
authored
Merge pull request #7 from rdkcentral/feature/issue-4
RDKB-60107: Captive Portal is looping after FR
2 parents ff5a15c + 2a23b3f commit efa194f

File tree

1 file changed

+34
-16
lines changed

1 file changed

+34
-16
lines changed

source/Styles/xb3/jst/captiveportal.jst

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -346,30 +346,48 @@ $(document).ready(function(){
346346
var network5_name = addslashes($("#WiFi5_Name").val());
347347
var network5_password = addslashes($("#WiFi5_Password").val());
348348
var jsConfig;
349+
var retryToSave = true;
350+
var retryCount = 0;
349351
if($("#dualSettings").css('display') == "block" && !$("#selectSettings" ).is(":checked")){
350352
jsConfig = '{"dualband":"true", "network_name":"'+network_name+'", "network_password":"'+network_password+'", "network5_name":"'+network5_name+'", "network5_password":"'+network5_password+'", "phoneNumber":"'+EMS_mobileNumber()+'"}';
351353
}
352354
else {
353355
jsConfig = '{"dualband":"false", "network_name":"'+network_name+'", "network_password":"'+network_password+'", "phoneNumber":"'+EMS_mobileNumber()+'"}';
354356
}
355-
$.ajax({
356-
type: "POST",
357-
url: "actionHandler/ajaxSet_wireless_network_configuration_redirection.jst",
358-
data: { rediection_Info: jsConfig,csrfp_token: token },
359-
success: function (msg, status, jqXHR) {
360-
//msg is the response
361-
msg = JSON.parse(msg);
362-
if(msg[0] == "outOfCaptivePortal")
363-
{
364-
setTimeout(function(){
365-
location.href="index.jst";
366-
}, 10000);
357+
function postConfig(){
358+
$.ajax({
359+
type: "POST",
360+
url: "actionHandler/ajaxSet_wireless_network_configuration_redirection.jst",
361+
data: { rediection_Info: jsConfig, csrfp_token: token },
362+
success: function (msg, status, jqXHR) {
363+
//msg is the response
364+
msg = JSON.parse(msg);
365+
if(msg[0] == "outOfCaptivePortal") {
366+
setTimeout(function(){
367+
location.href="index.jst";
368+
}, 10000);
369+
}
370+
if(connectionType != "WiFi"){
371+
setTimeout(function(){ goToReady(); }, 25000);
372+
}
373+
},
374+
error: function(xhr, status, error) {
375+
// Handle error
376+
console.log("Captiveportal AJAX Error:", error);
377+
console.log("Captiveportal Retrying to Save. retryCount:"+retryCount);
378+
if(retryToSave) {
379+
if(retryCount === 3) {
380+
retryToSave = false;
381+
}
382+
//Increment retryCount
383+
retryCount++;
384+
//retry after 3 sec
385+
setTimeout(function(){ postConfig(); }, 3000);
386+
}
367387
}
368-
}
369-
});
370-
if(connectionType != "WiFi"){
371-
setTimeout(function(){ goToReady(); }, 25000);
388+
});
372389
}
390+
postConfig();
373391
}
374392
var NameTimeout, PasswordTimeout, Name5Timeout, Password5Timeout, phoneNumberTimeout, agreementTimeout;
375393
function messageHandler(target, topMessage, bottomMessage){

0 commit comments

Comments
 (0)