diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d6d7a65da..9b5747792 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
package="leszcz_team.wulkanowy">
+
{
@@ -19,6 +21,13 @@ public class Login extends AsyncTask {
String county;
Activity activity;
String userMesage;
+ String wresults;
+ String wa;
+ Document doc4;
+ String htmlDefault = "https://cufs.vulcan.net.pl/Default/Account/LogOn";
+ String htmlStage2 = "https://cufs.vulcan.net.pl/{locationID}/FS/LS?wa=wsignin1.0&wtrealm=https://uonetplus.vulcan.net.pl/{locationID}/LoginEndpoint.aspx&wctx=https://uonetplus.vulcan.net.pl/{locationID}/LoginEndpoint.aspx";
+ String htmlStage3 = "https://uonetplus.vulcan.net.pl/{locationID}/LoginEndpoint.aspx";
+
public Login(String emailT, String passwordT, String countyT, Activity mainAC){
@@ -32,8 +41,6 @@ public class Login extends AsyncTask {
@Override
protected Void doInBackground(Void... params) {
- String htmlDefault = "https://cufs.vulcan.net.pl/Default/Account/LogOn";
-
try {
Connection.Response initial = Jsoup
.connect(htmlDefault)
@@ -46,6 +53,28 @@ public class Login extends AsyncTask {
CheckPass checkPass = new CheckPass(initial);
userMesage = checkPass.start();
+
+ county = county.replace("ł", "l");
+ htmlStage2 = htmlStage2.replace("{locationID}", county);
+
+ Document doc = Jsoup.connect(htmlStage2)
+ .cookies(loginCookies)
+ .get();
+
+ Elements wresultsInput = doc.select("input[name=wresult]");
+ wresults = wresultsInput.attr("value");
+
+ Elements waInput = doc.select("input[name=wa]");
+ wa = waInput.attr("value");
+
+ htmlStage3 = htmlStage3.replace("{locationID}", county);
+
+ doc4 = Jsoup.connect(htmlStage3)
+ .data("wa", wa)
+ .data("wresults", wresults)
+ .post();
+
+
}
catch (IOException e){
userMesage = e.toString();
@@ -57,7 +86,7 @@ public class Login extends AsyncTask {
protected void onPostExecute(Void result) {
super.onPostExecute(result);
if (!userMesage.isEmpty()){
- Toast.makeText(activity, userMesage, Toast.LENGTH_LONG).show();
+ Toast.makeText(activity, userMesage , Toast.LENGTH_LONG).show();
}
}
}