2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-12 22:56:34 +00:00

01_FHEMWEB.pm: change return code for bad csrf from 401 to 400 (Forum #67848)

git-svn-id: https://svn.fhem.de/fhem/trunk@13563 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-03-01 12:05:12 +00:00
parent c9ac23c1ae
commit 7002566cbd
3 changed files with 4 additions and 4 deletions

View File

@ -817,7 +817,7 @@ FW_answerCall($)
if($supplied ne $want) { if($supplied ne $want) {
Log3 $FW_wname, 3, "FHEMWEB $FW_wname CSRF error: $supplied ne $want. ". Log3 $FW_wname, 3, "FHEMWEB $FW_wname CSRF error: $supplied ne $want. ".
"For detals see the csrfToken FHEMWEB attribute"; "For detals see the csrfToken FHEMWEB attribute";
$FW_httpRetCode = "401 Unauthorized"; $FW_httpRetCode = "400 Bad Request";
return 0; return 0;
} }
} }

View File

@ -25,7 +25,7 @@ fd_fC(fn, callback)
$.ajax({ $.ajax({
url:cmd, method:'POST', cache:false, success:callback, url:cmd, method:'POST', cache:false, success:callback,
error:function(xhr, status, err) { error:function(xhr, status, err) {
if(xhr.status == 401 && csrfToken) { if(xhr.status == 400 && csrfToken) {
csrfToken = ""; csrfToken = "";
fd_csrfRefresh(function(){fd_fC(fn, callback)}); fd_csrfRefresh(function(){fd_fC(fn, callback)});
} else { } else {

View File

@ -406,7 +406,7 @@ FW_cmd(arg, callback)
FW_errmsg(req.responseText, 5000); FW_errmsg(req.responseText, 5000);
}, },
error:function(xhr, status, err) { error:function(xhr, status, err) {
if(xhr.status == 401 && typeof FW_csrfToken != "undefined") { if(xhr.status == 400 && typeof FW_csrfToken != "undefined") {
FW_csrfToken = ""; FW_csrfToken = "";
FW_csrfRefresh(function(){FW_cmd(arg, callback)}); FW_csrfRefresh(function(){FW_cmd(arg, callback)});
} }
@ -759,7 +759,7 @@ FW_doUpdate(evt)
} else { } else {
if(FW_pollConn.readyState == 4 && !FW_leaving) { if(FW_pollConn.readyState == 4 && !FW_leaving) {
if(FW_pollConn.status == "401") { if(FW_pollConn.status == "400") {
location.reload(); location.reload();
return; return;
} }