forked from github/wulkanowy-mirror
#2 Add checking corect password and e-mail
This commit is contained in:
parent
d51e969f0a
commit
8a8f1359d1
@ -0,0 +1,30 @@
|
||||
package leszcz_team.wulkanowy.activity.main;
|
||||
|
||||
import org.jsoup.Connection;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CheckPass {
|
||||
|
||||
Connection.Response page;
|
||||
|
||||
public CheckPass (Connection.Response pageT){
|
||||
page = pageT;
|
||||
}
|
||||
|
||||
public String start (){
|
||||
try{
|
||||
Document document = page.parse();
|
||||
Elements mesageAlert = document.getElementsByClass("ErrorMessage center");
|
||||
return mesageAlert.text();
|
||||
}
|
||||
catch (IOException e){
|
||||
return e.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,8 @@ import android.widget.Toast;
|
||||
|
||||
import org.jsoup.Connection;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.select.Elements;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
@ -16,7 +18,7 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
||||
String password;
|
||||
String county;
|
||||
Activity activity;
|
||||
String test;
|
||||
String userMesage;
|
||||
|
||||
public Login(String emailT, String passwordT, String countyT, Activity mainAC){
|
||||
|
||||
@ -42,9 +44,11 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
Map<String, String> loginCookies = initial.cookies();
|
||||
|
||||
CheckPass checkPass = new CheckPass(initial);
|
||||
userMesage = checkPass.start();
|
||||
}
|
||||
catch (IOException e){
|
||||
test = e.toString();
|
||||
userMesage = e.toString();
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -52,6 +56,8 @@ public class Login extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
protected void onPostExecute(Void result) {
|
||||
super.onPostExecute(result);
|
||||
Toast.makeText(activity, test, Toast.LENGTH_LONG).show();
|
||||
if (!userMesage.isEmpty()){
|
||||
Toast.makeText(activity, userMesage, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ buildscript {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.0'
|
||||
classpath 'com.android.tools.build:gradle:2.3.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
Loading…
Reference in New Issue
Block a user