mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 15:54:38 +01:00
#1 Add login POST
This commit is contained in:
parent
2152da687c
commit
d2f694d10f
@ -20,11 +20,12 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||||
exclude group: 'com.android.support', module: 'support-annotations'
|
exclude group: 'com.android.support', module: 'support-annotations'
|
||||||
})
|
})
|
||||||
compile 'com.android.support:appcompat-v7:25.1.1'
|
compile 'com.android.support:appcompat-v7:25.1.1'
|
||||||
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
compile 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
|
compile files('libs/jsoup-1.10.2.jar')
|
||||||
}
|
}
|
||||||
|
BIN
app/libs/jsoup-1.10.2.jar
Normal file
BIN
app/libs/jsoup-1.10.2.jar
Normal file
Binary file not shown.
@ -2,6 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="leszcz_team.wulkanowy">
|
package="leszcz_team.wulkanowy">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package leszcz_team.wulkanowy.activity.main;
|
package leszcz_team.wulkanowy.activity.main;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import leszcz_team.wulkanowy.R;
|
import org.jsoup.Connection;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class Login extends AsyncTask<Void, Void, Void> {
|
public class Login extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
@ -13,29 +16,42 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
|||||||
String password;
|
String password;
|
||||||
String county;
|
String county;
|
||||||
Activity activity;
|
Activity activity;
|
||||||
|
String test;
|
||||||
|
|
||||||
public Login(String emailT, String passwordT, String countyT, Activity mainAC){
|
public Login(String emailT, String passwordT, String countyT, Activity mainAC){
|
||||||
|
|
||||||
email = emailT;
|
email = emailT;
|
||||||
password = passwordT;
|
password = passwordT;
|
||||||
county = "powiat" + countyT;
|
|
||||||
|
county = "powiat" + countyT.substring(7);
|
||||||
activity = mainAC;
|
activity = mainAC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
|
|
||||||
|
String htmlDefault = "https://cufs.vulcan.net.pl/Default/Account/LogOn";
|
||||||
|
|
||||||
|
try {
|
||||||
|
Connection.Response initial = Jsoup
|
||||||
|
.connect(htmlDefault)
|
||||||
|
.data("LoginName", email)
|
||||||
|
.data("Password", password)
|
||||||
|
.method(Connection.Method.POST)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
Map<String, String> loginCookies = initial.cookies();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (IOException e){
|
||||||
|
test = e.toString();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
new AlertDialog.Builder(activity)
|
Toast.makeText(activity, test, Toast.LENGTH_LONG).show();
|
||||||
.setTitle(R.string.warning_label)
|
|
||||||
.setMessage(R.string.error_feature_text)
|
|
||||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int which) {}
|
|
||||||
})
|
|
||||||
.setIcon(android.R.drawable.ic_dialog_alert)
|
|
||||||
.show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,5 @@
|
|||||||
<string name="warning_text">Aplikacja ta nie jest ukończona, więc mogą występować różnego rodzaju błędy lub dane funkcje nie bedą działać. Prosimy o cierpliwość i wyrozumiałość.</string>
|
<string name="warning_text">Aplikacja ta nie jest ukończona, więc mogą występować różnego rodzaju błędy lub dane funkcje nie bedą działać. Prosimy o cierpliwość i wyrozumiałość.</string>
|
||||||
<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ś urucThe function you wanted to run does not workhomić nie działa</string>
|
<string name="error_feature_text">Funkcja którą chciałeś uruchomić nie działa</string>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user