멋진 사람들, 사용자가 입력 한 정보의 일부를 확인하기 위해 oData를 사용하고 있습니다. 큰 문제는 예를 들어 Chrome 디버거에서 쉽게 수행 할 수있는 교차 사이트 스크립팅을 피하는 것입니다. 어떻게 이것을 피할 수 있습니까?JavaScript SAPUI5를 사용하여 교차 사이트 스크립팅을 방지하려면 어떻게해야합니까? 사용자와 비밀번호의 유효성을 검사 할 때?
내 코드 :
onPress: function(oEvent) {
var event = this.getView().getModel("loggin").getProperty("/TypeCon");
var TestMode = this.getView().getModel("loggin").getProperty("/TestMode");
if (event == ""){
event = "SAP";
}
if (event != 'SAP'){
MessageToast.show("Esta conexão ainda não está disponível");
}else{
if(TestMode == 'X'){
this.getRouter().navTo("CockpitGo");
}else{
var oEntry = {};
oEntry.User= this.getView().getModel("loggin").getProperty("/User");
oEntry.Password= this.getView().getModel("loggin").getProperty("/Password");
var sServiceUrl = "http://abapfox.ddns.net:8000/sap/opu/odata/SAP/YLOGGIN_DATA_SRV/";
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true);
//Vamos montar antes o URI pra ver se fica tudo certinho:
var Uri = "/sap/opu/odata/SAP/YLOGGIN_DATA_SRV/LoginDataSet(User='" + oEntry.User + "',Password='" + oEntry.Password + "')";
OData.request({
requestUri: Uri,
method: "GET",
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/atom+xml",
"DataServiceVersion": "2.0",
"X-CSRF-Token": "Fetch"
}
},
function(data, response) {
if (data.Success === true) {
// show message
MessageToast.show(data.Message);
this.getRouter().navTo("CockpitGo");
} else {
// show message
MessageToast.show(data.Message);
}
},