javascript - How to compare front-end user login inputs with oDatamodel json object in sapui5? or any other scenario to follow? -


// these user inputs , hold values in these variables, need comapare these values odata model json object values. // have created ztable columns username , password, data through odata service, need validate front end credentials odata backend. related solution helpful! thanks!

var user = sap.ui.getcore().byid("username").getvalue();
var pass = sap.ui.getcore().byid("password").getvalue();

 var sserviceurl1 = "proxy/http/xxxxxxxxxxxxxxxxxxxxx/sap/opu/odata/sap/zsample_project2_srv";              var omodel1 = new sap.ui.model.odata.odatamodel(sserviceurl1,true,"xxxxxxxx", "xxxxxxxx");          var ojsonmodel1 = new sap.ui.model.json.jsonmodel();                                            omodel1.read("/xxxxxxxxxxxx?",null,null,true,function(odata1,response){                        ojsonmodel1.setdata(odata1);                                           });                                           sap.ui.getcore().setmodel(ojsonmodel1);        //   {username} json object, how compare or how bind odata                                      if(user == "{username}" && pass == "{password}" ){                                           alert("successfully logged");                                           app.to("idnextpage");                                        }                                       else{                                          alert("login failed");                                          }                                       } 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -