I am implementing the possibility of authorization using the code, but there were difficulties.
The site itself has the following structure: enter image description here
<div class="webix_win_content">
<div class="webix_win_head">
<div class="webix_view webix_header webix_win_title" view_id="$template1" style="width: 300px; height: 26px;">
<div class=" webix_template">Auth</div>
</div>
</div>
<div class="webix_win_body">
<div class="webix_view webix_form webix_layout_form" role="form" view_id="myForm" style="width: 300px; height: 511px;">
<div class="webix_scroll_cont">
<div class="webix_view webix_control webix_el_richselect" view_id="$richselect1" style="border-width: 0px; margin-left: 12px; margin-top: 4px; width: 276px; height: 42px;">
<label style="text-align:left; line-height:13px; display:block;" onclick="" for="x1631034732210" class="webix_inp_top_label ">
<font size="+2">OR</font> Log in with a USPTU account
</label>
<div class="webix_el_box" style="width:276px; height:26px">
<div class="webix_inp_static" role="combobox" aria-label="<font size=+2>ИЛИ</font> Log in with a USPTU account" tabindex="0" onclick="" style="line-height:18px;width: 272px; text-align: left;" aria-autocomplete="list" aria-expanded="false" aria-live="assertive" aria-atomic="true">Login</div>
<span style="height:20px;padding-top:0px;" class="webix_input_icon wxi-menu-down"></span>
</div>
</div>
<div class="webix_view webix_control webix_el_text" view_id="username" style="border-width: 0px; margin-left: 12px; margin-top: 4px; width: 276px; height: 42px;">
<div class="webix_el_box" style="width:276px; height:42px">
<input id="1631034732212" type="text" value="" style="width: 272px; text-align: left;">
</div>
</div>
<div class="webix_view webix_control webix_el_text" view_id="password" style="border-width: 0px; margin-left: 12px; margin-top: 4px; width: 276px; height: 42px;">
<label style="text-align:left; line-height:13px; display:block;" onclick="" for="1631034732214" class="webix_inp_top_label ">Пароль</label>
<div class="webix_el_box" style="width:276px; height:26px">
<input id="1631034732214" type="password" value="" style="width: 272px; text-align: left;">
</div>
</div>
<div class="webix_view webix_control webix_el_label" view_id="$label1" style="border-width: 0px; margin-left: 12px; margin-top: 4px; width: 276px; height: 35px;">
<div class="webix_el_box" style="width:276px;height:35px;line-height:29px">
<div id="captcha" style="position: relative;">
<div class="slide-to-unlock-bg" style="width: 280px; height: 30px; background-color: rgb(232, 232, 232);">
<span style="line-height: 30px; font-size: 8.57143px; color: rgb(0, 0, 153);">Slide to unlock</span>
</div>
<div class="slide-to-unlock-progress" style="background-color: rgb(255, 233, 127); height: 28px;"></div>
<div class="slide-to-unlock-handle" style="background-color: rgb(255, 255, 255); height: 30px; line-height: 30px; width: 35px;"></div>
</div>
</div>
</div>
<div class="webix_view webix_control webix_el_button webix_secondary webix_disabled_view" view_id="button_logon" aria-disabled="true" style="border-width: 0px; margin-left: 12px; margin-top: 4px; width: 276px; height: 30px;">
<div class="webix_el_box webix_disabled_box webix_disabled_top_label" style="width:276px; height:30px">
<button type="button" class="webix_button" disabled="true">Sign In</button>
</div>
<div class="webix_disabled"></div>
</div>
</div>
</div>
</div>
After pressing the button, this code was activated:
webix.ajax().post("./login",'LData='+encodeURIComponent(JSON.stringify($$("myForm").getValues(), null, 0)),{
error:function(text, data, XmlHttpRequest){ alert("There is no response from the server! Refresh the page!"); },
success:function(text, data){
if (data.json().R == "Err" ) { webix.message({type:"error", text:data.json().Mess, expire:10000});
webix.alert({title:"Error",ok:"Ok",type:"alert-error",text: data.json().Mess /*,callback:function(){...}*/});
$$("button_logon").disable(); initSlider();
}
//if (data.json().R == "Ok" ) { //location.reload();
if (data.json().R != "Err" ) {
webix.storage.local.put("aut_ui_var_un", $$("username").getValue());
webix.SaveFormData("./reload",$$("myForm").getValues(), null, null, function(){}); //webix.alert("done");
}
}
});
I tried different options, but nothing worked and authorization did not pass
Connection.Response response = Jsoup
.connect("https://ams.rusoil.net/oau/login?typelogin=1&username=myuser&password=mypass")
.userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36")
.method(Connection.Method.POST)
.execute();
doc = Jsoup
.connect("https://ams.rusoil.net/pcs/")
//.cookies(response.cookies())
.get();
System.out.println(doc.toString());
or like this:
Connection.Response response = Jsoup
.connect("https://ams.rusoil.net/oau/login")
.data("username", "myuser")
.data("password", "mypass")
.data("typelogin", "1")
.method(Connection.Method.POST)
.execute();
or:
Document doc = Jsoup
.connect("https://ams.rusoil.net/oau/authorize?response_type=code&client_id=pcs_cli_serv772&redirect_uri=https%3A%2F%2Fams.rusoil.net%2Fpcs%2Froute_oau_resp&state%3D=4vcdopkaq4eh78a4mj1qvqluk2&scope=email+profile")
.data("typelogin", "1")
.data("username", "myuser")
.data("password", "mypass")
.userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36")
.cookies(response.cookies())
.post();
I will be glad of any help!