working on login improvement from pcb

parent abccd55a
......@@ -159,6 +159,7 @@ public class RestapiWrapper {
JSONresponse = null;
Log.e(RestapiWrapper.class.getCanonicalName(),e.getMessage());
}
Log.i(com.yottacode.net.RestapiWrapper.class.getName(), "server answer: " + JSONresponse.toString());
return JSONresponse;
}
public static JSONObject GET(String surl, Hashtable<String, String> params) throws IOException {
......@@ -243,6 +244,7 @@ public class RestapiWrapper {
@Override
protected HttpAsyncTaskParams doInBackground(HttpAsyncTaskParams... params) {
try {
Log.i(com.yottacode.net.RestapiWrapper.class.getName(), " asking to the server for " + params[0].url+" params:"+params[0].url_params +" "+params[0].json_params);
JSONObject jresult = params[0].request_method.equalsIgnoreCase("GET")
? GET(params[0].url, params[0].url_params)
: POST(params[0].url, params[0].request_method, params[0].url_params, params[0].json_params);
......
......@@ -244,7 +244,7 @@ public class Device extends SQLiteOpenHelper {
while (cursor.moveToNext() && users == null && !user_found) {
user_found = cursor.getString(1).equalsIgnoreCase(auser);
if (user_found)
if (cursor.getString(2).equals(apwd)) {
if (cursor.getString(2)!=null && cursor.getString(2).equals(apwd)) {
users = recoverStudents(cursor.getInt(0));
if (users.size() == 0)
throw new LoginException("Supervisor hasn't got students", LoginException.NO_STUDENTS);
......@@ -257,7 +257,7 @@ public class Device extends SQLiteOpenHelper {
while (cursor.moveToNext() && users == null && !user_found) {
user_found = cursor.getString(1).equalsIgnoreCase(auser);
if (user_found)
if (cursor.getString(2).equals(apwd)) {
if (cursor.getString(2)!=null && cursor.getString(2).equals(apwd)) {
users = new Vector<>(1);
users.add(new User(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5), cursor.getString(6), cursor.getString(7), cursor.getString(8),
User.NO_SUPERVISOR, "", "", "", "", "", "", "", ""));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment