Skip to content

Commit

Permalink
can login but not good check situation
Browse files Browse the repository at this point in the history
  • Loading branch information
yuichi10 committed Oct 9, 2015
1 parent 9873d24 commit b44171a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public class DataManage {
//static String server = "115.65.57.253:8989";
//static String server = "192.168.11.5";
final static String server = "192.168.11.3";
//final static String server = "192.168.179.13";
//static String server = "172.17.194.69";
final static String port = ":8989";
//use these ward when connect to server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ public class SignIn extends ActionBarActivity implements View.OnClickListener{
static String packageName = "pmv02.ppr.yuichi10.github.com.joinevents";

//data for json analyze
static String errPasskey = "ErrPass";
static String errIdkey = "ErrId";
static String ISERR = "is_err";
static String errPasskey = "pass_err";
static String errIdkey = "id_err";
static String errDescription = "err_description";
static String sessionKey = "SessionId";

//data responses
String errPassword = "";
String errId = "";
String mSessionID = "";
boolean mIsErr;
String mErrDescription = "";

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -76,7 +80,7 @@ public void onClick(View v) {
switch (v.getId()){
//when sing in button was pushed
case R.id.doSignIn:
//get server info
//get server inf
String server = DataManage.server;
String path = "login";
//get ID and password
Expand All @@ -86,8 +90,12 @@ public void onClick(View v) {
hc.setPostParameter("Id", strID);
hc.setPostParameter("Password", strPass);
String response = hc.Post();
analyseJson(response);

analyseJson(response);
Log.d("bbb", " try sign in " + response);
if(mIsErr || response == "" || response == null){
return;
}
//if the password and ID was collect, go to Home activity
intent.setClassName(packageName, packageName + ".Home");
startActivity(intent);
Expand All @@ -104,12 +112,19 @@ public void onClick(View v) {
public void analyseJson(String jStr){
try {
JSONObject json = new JSONObject(jStr);
this.errPassword = json.getString(errPasskey);
this.errId = json.getString(errIdkey);
this.mSessionID = json.getString(sessionKey);
Log.d("aaa",errPassword);
Log.d("aaa",errId);
Log.d("aaa",mSessionID);
this.mIsErr = json.getBoolean(ISERR);
Log.d("bbb", "check err:" + mIsErr);
Log.d("bbb", "json :" + jStr);
if(mIsErr) {
this.errPassword = json.getString(errPasskey);
this.errId = json.getString(errIdkey);
this.mErrDescription = json.getString(errDescription);
//this.mSessionID = json.getString(sessionKey);
Log.d("bbb", errPassword);
Log.d("bbb", errId);
Log.d("bbb", mSessionID);
Log.d("bbb", mErrDescription);
}
}catch (Exception e){

}
Expand Down

0 comments on commit b44171a

Please sign in to comment.