forked from github/wulkanowy-mirror
Implement debug login (loginData.xml)
This commit is contained in:
parent
7cc74fefec
commit
49d41d02d3
@ -8,12 +8,12 @@ import org.jsoup.Connection;
|
|||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.select.Elements;
|
import org.jsoup.select.Elements;
|
||||||
import org.jsoup.helper.HttpConnection.Response;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import leszcz_team.wulkanowy.R;
|
||||||
|
|
||||||
public class Login extends AsyncTask<Void, Void, Void> {
|
public class Login extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
String email;
|
String email;
|
||||||
@ -25,17 +25,30 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
|||||||
Activity activity;
|
Activity activity;
|
||||||
String userMesage;
|
String userMesage;
|
||||||
|
|
||||||
String urlForStepOne = "https://cufs.vulcan.net.pl/Default/Account/LogOn";
|
String urlForStepOne;
|
||||||
String urlForStepTwo = "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 urlForStepTwo;
|
||||||
String urlForStepThree = "https://uonetplus.vulcan.net.pl/{locationID}/LoginEndpoint.aspx";
|
String urlForStepThree;
|
||||||
|
|
||||||
public Login(String emailT, String passwordT, String countyT, Activity mainAC){
|
public Login(String emailT, String passwordT, String countyT, Activity mainAC){
|
||||||
|
|
||||||
|
activity = mainAC;
|
||||||
|
|
||||||
|
if (emailT.equals("Debug")){
|
||||||
|
urlForStepOne = activity.getString(R.string.urlStepOneDebug);
|
||||||
|
urlForStepTwo = activity.getString(R.string.urlStepTwoDebug);
|
||||||
|
urlForStepThree = activity.getString(R.string.urlStepThreeDebug);
|
||||||
|
county = activity.getString(R.string.countyDebug);
|
||||||
|
email = activity.getString(R.string.emailDebug);
|
||||||
|
password = passwordT;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
urlForStepOne = activity.getString(R.string.urlStepOneRelease);
|
||||||
|
urlForStepTwo = activity.getString(R.string.urlStepTwoRelease);
|
||||||
|
urlForStepThree = activity.getString(R.string.urlStepThreeRelease);
|
||||||
|
county = "powiat" + countyT.substring(7);
|
||||||
email = emailT;
|
email = emailT;
|
||||||
password = passwordT;
|
password = passwordT;
|
||||||
|
}
|
||||||
county = "powiat" + countyT.substring(7);
|
|
||||||
activity = mainAC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,9 +67,10 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
|||||||
String helloText = dashboardHtml.getElementsByClass("welcome").text();
|
String helloText = dashboardHtml.getElementsByClass("welcome").text();
|
||||||
|
|
||||||
if (helloText.equals("Dzień dobry!")) {
|
if (helloText.equals("Dzień dobry!")) {
|
||||||
userMesage = "Zalogowano pomyślnie! " + helloText;
|
userMesage = activity.getString(R.string.login_accepted);
|
||||||
} else {
|
}
|
||||||
userMesage = "Coś poszło nie tak :/";
|
else {
|
||||||
|
userMesage = activity.getString(R.string.login_denied);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e){
|
catch (IOException e){
|
||||||
|
@ -54,12 +54,13 @@ public class MainActivity extends Activity {
|
|||||||
String email = adressEmail.getText().toString();
|
String email = adressEmail.getText().toString();
|
||||||
String county = countyText.getText().toString();
|
String county = countyText.getText().toString();
|
||||||
|
|
||||||
if (password.isEmpty() || email.isEmpty() || county.isEmpty()){
|
if (!email.isEmpty() || !password.isEmpty() || !county.isEmpty()){
|
||||||
Toast.makeText(this, R.string.data_text, Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
new Login(email, password, county, this).execute();
|
new Login(email, password, county, this).execute();
|
||||||
}
|
}
|
||||||
|
else if (password.isEmpty() || email.isEmpty() || county.isEmpty()) {
|
||||||
|
Toast.makeText(this, R.string.data_text, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,4 +11,6 @@
|
|||||||
<string name="warning_label">Ostrzeżenie</string>
|
<string name="warning_label">Ostrzeżenie</string>
|
||||||
<string name="data_text">Brak danych logowania</string>
|
<string name="data_text">Brak danych logowania</string>
|
||||||
<string name="error_feature_text">Funkcja którą chciałeś uruchomić nie działa</string>
|
<string name="error_feature_text">Funkcja którą chciałeś uruchomić nie działa</string>
|
||||||
|
<string name="login_accepted">Pomyślnie zalogowano</string>
|
||||||
|
<string name="login_denied">Logowanie nie powiodło się</string>
|
||||||
</resources>
|
</resources>
|
12
app/src/main/res/values/loginData.xml
Normal file
12
app/src/main/res/values/loginData.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="urlStepOneRelease">https://cufs.vulcan.net.pl/Default/Account/LogOn</string>
|
||||||
|
<string name="urlStepTwoRelease">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>
|
||||||
|
<string name="urlStepThreeRelease">https://uonetplus.vulcan.net.pl/{locationID}/LoginEndpoint.aspx"</string>
|
||||||
|
<string name="urlStepOneDebug">https://cufsdemo.vulcan.net.pl/Default/Account/LogOn</string>
|
||||||
|
<string name="urlStepTwoDebug">https://cufsdemo.vulcan.net.pl/{locationID}/FS/LS?wa=wsignin1.0&wtrealm=https://uonetplusdemo.vulcan.net.pl/{locationID}/LoginEndpoint.aspx&wctx=https://uonetplusdemo.vulcan.net.pl/{locationID}/LoginEndpoint.aspx</string>
|
||||||
|
<string name="urlStepThreeDebug">https://uonetplusdemo.vulcan.net.pl/{locationID}/LoginEndpoint.aspx"</string>
|
||||||
|
<string name="emailDebug">u43063@demouonetplus.vulcan.net.pl</string>
|
||||||
|
<string name="countyDebug">demouonetplus</string>
|
||||||
|
|
||||||
|
</resources>
|
@ -10,4 +10,6 @@
|
|||||||
<string name="warning_label">Warning</string>
|
<string name="warning_label">Warning</string>
|
||||||
<string name="data_text">No login data</string>
|
<string name="data_text">No login data</string>
|
||||||
<string name="error_feature_text">The function you wanted to run does not work</string>
|
<string name="error_feature_text">The function you wanted to run does not work</string>
|
||||||
|
<string name="login_accepted">Login is successful</string>
|
||||||
|
<string name="login_denied">Login is failed</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user