Merge branch 'features/user' into develop
This commit is contained in:
commit
50b06a9de0
|
@ -1,7 +1,5 @@
|
||||||
package monnethic.mobile.database;
|
package monnethic.mobile.database;
|
||||||
|
|
||||||
import com.j256.ormlite.field.DatabaseField;
|
|
||||||
import com.j256.ormlite.table.DatabaseTable;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,28 +8,47 @@ import java.util.Date;
|
||||||
|
|
||||||
//Class User which represent an User for api rest
|
//Class User which represent an User for api rest
|
||||||
public class User {
|
public class User {
|
||||||
private int userId;
|
private int user_id;
|
||||||
private String name;
|
private String name;
|
||||||
private String firstname;
|
private String firstname;
|
||||||
private String email;
|
private String email;
|
||||||
private String password;
|
private String password;
|
||||||
private long creation_date;
|
private long creation_date;
|
||||||
private long modification_date;
|
private long modification_date;
|
||||||
|
private String phone;
|
||||||
|
private String association;
|
||||||
private boolean verified;
|
private boolean verified;
|
||||||
private boolean approved;
|
private boolean approved;
|
||||||
private String user_hash;
|
private String user_hash;
|
||||||
|
|
||||||
//Constructors
|
//Constructors
|
||||||
public User(){}
|
public User() {
|
||||||
public User(String name, String firstname, String email, String password) {
|
}
|
||||||
this.name = name;
|
|
||||||
this.firstname = firstname;
|
public User(String email, String password){
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
public User(int userId, String name, String firstname, String user_hash, String email, String password, long creation_date, long modification_date, boolean verified, boolean approved) {
|
public User(String name, String firstname, String email, String password, String association) {
|
||||||
this.userId=userId;
|
this.name = name;
|
||||||
|
this.firstname = firstname;
|
||||||
|
this.email = email;
|
||||||
|
this.password = password;
|
||||||
|
this.association = association;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User(String name, String firstname, String email, String password, String phone, String association){
|
||||||
|
this.name = name;
|
||||||
|
this.firstname = firstname;
|
||||||
|
this.email = email;
|
||||||
|
this.password = password;
|
||||||
|
this.phone = phone;
|
||||||
|
this.association = association;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public User(String name, String firstname,String user_hash, String email, String password, long creation_date, long modification_date, boolean verified, boolean approved) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.firstname = firstname;
|
this.firstname = firstname;
|
||||||
this.user_hash = user_hash;
|
this.user_hash = user_hash;
|
||||||
|
@ -43,10 +60,26 @@ public class User {
|
||||||
this.approved = approved;
|
this.approved = approved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User(String name, String firstname,String user_hash, String email, String password, long creation_date, long modification_date, String phone, String association, boolean verified, boolean approved) {
|
||||||
|
this.name = name;
|
||||||
|
this.firstname = firstname;
|
||||||
|
this.user_hash = user_hash;
|
||||||
|
this.email = email;
|
||||||
|
this.password = password;
|
||||||
|
this.creation_date = creation_date;
|
||||||
|
this.modification_date = modification_date;
|
||||||
|
this.phone = phone;
|
||||||
|
this.association = association;
|
||||||
|
this.verified = verified;
|
||||||
|
this.approved = approved;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Getters and Setters
|
//Getters and Setters
|
||||||
public int getUserId(){return userId;}
|
public int getUserId() {
|
||||||
public void setUserId(int userId){this.userId=userId;}
|
return user_id;
|
||||||
|
}
|
||||||
|
public void setUserId(int userId) {this.user_id = userId;}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
@ -55,6 +88,10 @@ public class User {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUser_hash(){return user_hash;}
|
||||||
|
public void setUser_hash(String user_hash){this.user_hash = user_hash;}
|
||||||
|
|
||||||
|
|
||||||
public String getFirstname() {
|
public String getFirstname() {
|
||||||
return firstname;
|
return firstname;
|
||||||
}
|
}
|
||||||
|
@ -62,9 +99,6 @@ public class User {
|
||||||
this.firstname = firstname;
|
this.firstname = firstname;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUser_hash(){return user_hash;}
|
|
||||||
public void setUser_hash(String user_hash){this.user_hash=user_hash;}
|
|
||||||
|
|
||||||
public String getEmail() {
|
public String getEmail() {
|
||||||
return email;
|
return email;
|
||||||
}
|
}
|
||||||
|
@ -93,6 +127,12 @@ public class User {
|
||||||
this.modification_date = modification_date;
|
this.modification_date = modification_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPhone(){return phone;}
|
||||||
|
public void setPhone(String phone){this.phone=phone;}
|
||||||
|
|
||||||
|
public String getAssociation(){return association;}
|
||||||
|
public void setAssociation(){this.association=association;}
|
||||||
|
|
||||||
public boolean isVerified() {
|
public boolean isVerified() {
|
||||||
return verified;
|
return verified;
|
||||||
}
|
}
|
||||||
|
@ -106,4 +146,23 @@ public class User {
|
||||||
public void setApproved(boolean approved) {
|
public void setApproved(boolean approved) {
|
||||||
this.approved = approved;
|
this.approved = approved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "User{" +
|
||||||
|
"userId=" + user_id +
|
||||||
|
", name='" + name + '\'' +
|
||||||
|
", firstname='" + firstname + '\'' +
|
||||||
|
", email='" + email + '\'' +
|
||||||
|
", password='" + password + '\'' +
|
||||||
|
", creation_date=" + creation_date +
|
||||||
|
", modification_date=" + modification_date +
|
||||||
|
", phone= "+phone+
|
||||||
|
", association= "+association+
|
||||||
|
", verified=" + verified +
|
||||||
|
", approved=" + approved +
|
||||||
|
", user_hash='" + user_hash + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package monnethic.mobile.homepage;
|
package monnethic.mobile.homepage;
|
||||||
|
|
||||||
|
import android.os.AsyncTask;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import monnethic.mobile.restApi.Config;
|
||||||
|
import monnethic.mobile.restApi.UserApiHandler;
|
||||||
|
|
||||||
public class InputController {
|
public class InputController {
|
||||||
private static Pattern pattern;
|
private static Pattern pattern;
|
||||||
private static Matcher matcher;
|
private static Matcher matcher;
|
||||||
|
@ -28,15 +32,24 @@ public class InputController {
|
||||||
return matcher.matches();
|
return matcher.matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO VERIFY IF INPUTED USER ALREADY EXIST IN LDAP
|
|
||||||
public static boolean checkUser(String mail){
|
public static Boolean checkUser(String email){
|
||||||
//Statement stmt = null;
|
boolean result = false;
|
||||||
//String query = "SELECT userId FROM USER_TABLE WHERE email="+mail+";";
|
try{
|
||||||
return false;
|
String[] params = new String[]{email};
|
||||||
|
return new CheckUserTask().execute(params).get();
|
||||||
|
} catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO CHECK USER AND SEND BACK ID
|
private static class CheckUserTask extends AsyncTask<String,String,Boolean> {
|
||||||
public static boolean checkUser(String mail, String password){
|
|
||||||
return true;
|
@Override
|
||||||
|
protected Boolean doInBackground(String... params) {
|
||||||
|
UserApiHandler userApiHandler = new UserApiHandler();
|
||||||
|
return userApiHandler.checkUser(params[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import com.example.monnthic.monnethicmobile.R;
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import monnethic.mobile.restApi.Config;
|
import monnethic.mobile.database.User;
|
||||||
import monnethic.mobile.restApi.HttpCallHandler;
|
import monnethic.mobile.restApi.UserApiHandler;
|
||||||
import monnethic.mobile.wallet.HomeWalletActivity;
|
import monnethic.mobile.wallet.HomeWalletActivity;
|
||||||
|
|
||||||
public class LoginActivity extends AppCompatActivity {
|
public class LoginActivity extends AppCompatActivity {
|
||||||
|
@ -56,35 +56,35 @@ public class LoginActivity extends AppCompatActivity {
|
||||||
} else if(InputController.isEmptyEdit(password)) {
|
} else if(InputController.isEmptyEdit(password)) {
|
||||||
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "You did not enter your password", Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
if(InputController.checkUser(email.getText().toString(),password.getText().toString())){
|
User user = new User(email.getText().toString(),password.getText().toString());
|
||||||
String[] params = {email.getText().toString(),password.getText().toString()};
|
new UserLoggerTask(this).execute(user);
|
||||||
new UserLoggerTask(this).execute(params);
|
|
||||||
}else{
|
|
||||||
Toast.makeText(this, "Wrong authentication", Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//AsyncTask for login
|
//AsyncTask for login
|
||||||
private class UserLoggerTask extends AsyncTask<String,String,JSONObject> {
|
private class UserLoggerTask extends AsyncTask<User,String,JSONObject> {
|
||||||
Context mContext;
|
Context mContext;
|
||||||
private UserLoggerTask(final Context context){
|
private UserLoggerTask(final Context context){
|
||||||
mContext = context;
|
mContext = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(JSONObject result) {
|
protected void onPostExecute(JSONObject jsonObject) {
|
||||||
try{
|
try{
|
||||||
if(result!=null){
|
if(jsonObject!=null){
|
||||||
if(result.getInt("status") == 200){
|
if(jsonObject.getInt("status")==404){
|
||||||
|
Toast.makeText(mContext, "User Not Found", Toast.LENGTH_SHORT).show();
|
||||||
|
} else if(jsonObject.getInt("status")==403){
|
||||||
|
Toast.makeText(mContext, "Wrong authentication", Toast.LENGTH_SHORT).show();
|
||||||
|
} else if(jsonObject.getInt("status")==200){
|
||||||
Intent walletHomeIntent = new Intent(LoginActivity.this, HomeWalletActivity.class);
|
Intent walletHomeIntent = new Intent(LoginActivity.this, HomeWalletActivity.class);
|
||||||
walletHomeIntent.putExtra("USER_HASH", result.getString("user_hash"));
|
walletHomeIntent.putExtra("USER_HASH", jsonObject.getString("user_hash"));
|
||||||
walletHomeIntent.putExtra("USER_PWD",password.getText().toString());
|
walletHomeIntent.putExtra("USER_PWD",password.getText().toString());
|
||||||
walletHomeIntent.putExtra("SESSION_ID","0");
|
walletHomeIntent.putExtra("SESSION_ID",jsonObject.getString("session_id"));
|
||||||
LoginActivity.this.startActivity(walletHomeIntent);
|
LoginActivity.this.startActivity(walletHomeIntent);
|
||||||
finish();
|
finish();
|
||||||
}else{
|
} else {
|
||||||
Toast.makeText(mContext, result.getString("response"), Toast.LENGTH_SHORT).show();
|
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||||
|
@ -94,12 +94,10 @@ public class LoginActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected JSONObject doInBackground(String... params) {
|
protected JSONObject doInBackground(User... u) {
|
||||||
try{
|
try{
|
||||||
String url = Config.USER_LOGIN;
|
UserApiHandler userApiHandler = new UserApiHandler();
|
||||||
String[] paramsList = {params[0],params[1]};
|
return userApiHandler.loginUser(u[0]);
|
||||||
HttpCallHandler httpCallHandler = new HttpCallHandler(); //TODO UserApiHandler
|
|
||||||
return new JSONObject(httpCallHandler.executeLoginHttp(url,paramsList));
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -9,15 +9,11 @@ import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.example.monnthic.monnethicmobile.R;
|
import com.example.monnthic.monnethicmobile.R;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import monnethic.mobile.database.User;
|
import monnethic.mobile.database.User;
|
||||||
import monnethic.mobile.restApi.Config;
|
import monnethic.mobile.restApi.UserApiHandler;
|
||||||
import monnethic.mobile.restApi.HttpCallHandler;
|
import monnethic.mobile.wallet.HomeWalletActivity;
|
||||||
import monnethic.mobile.user.UserAccountActivity;
|
|
||||||
|
|
||||||
public class RegisterActivity extends AppCompatActivity {
|
public class RegisterActivity extends AppCompatActivity {
|
||||||
private EditText name;
|
private EditText name;
|
||||||
|
@ -26,6 +22,7 @@ public class RegisterActivity extends AppCompatActivity {
|
||||||
private EditText confirmEmail;
|
private EditText confirmEmail;
|
||||||
private EditText password;
|
private EditText password;
|
||||||
private EditText confirmPassword;
|
private EditText confirmPassword;
|
||||||
|
private EditText phone;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -38,6 +35,7 @@ public class RegisterActivity extends AppCompatActivity {
|
||||||
confirmEmail = findViewById(R.id.inputConfEmail);
|
confirmEmail = findViewById(R.id.inputConfEmail);
|
||||||
password = findViewById(R.id.inputPassword);
|
password = findViewById(R.id.inputPassword);
|
||||||
confirmPassword = findViewById(R.id.inputConfPassword);
|
confirmPassword = findViewById(R.id.inputConfPassword);
|
||||||
|
phone = findViewById(R.id.inputPhone);
|
||||||
Button buttonCancel = findViewById(R.id.buttonCancel);
|
Button buttonCancel = findViewById(R.id.buttonCancel);
|
||||||
Button buttonOk = findViewById(R.id.buttonOk);
|
Button buttonOk = findViewById(R.id.buttonOk);
|
||||||
|
|
||||||
|
@ -59,9 +57,13 @@ public class RegisterActivity extends AppCompatActivity {
|
||||||
if(checkInputEmpty()){
|
if(checkInputEmpty()){
|
||||||
if(!InputController.passwordValidator(password.getText().toString())){
|
if(!InputController.passwordValidator(password.getText().toString())){
|
||||||
Toast.makeText(this, "Password must contains 6 to 20 characters, one lowercase, one uppercase and one digit", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "Password must contains 6 to 20 characters, one lowercase, one uppercase and one digit", Toast.LENGTH_LONG).show();
|
||||||
}else if(InputController.validEmail(email.getText().toString())){
|
}else if(InputController.validEmail(email.getText().toString())){ //checkUser
|
||||||
User inputUser = new User(name.getText().toString(),firstname.getText().toString(),email.getText().toString(),password.getText().toString());
|
if(!InputController.checkUser(email.getText().toString())){
|
||||||
new UserRegisterTask(this).execute(inputUser);
|
User inputUser = new User(name.getText().toString(),firstname.getText().toString(),email.getText().toString(),password.getText().toString(),phone.getText().toString(),"gonette");
|
||||||
|
new UserRegisterTask(this).execute(inputUser);
|
||||||
|
} else {
|
||||||
|
Toast.makeText(this, "User already exist", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,18 +111,15 @@ public class RegisterActivity extends AppCompatActivity {
|
||||||
private UserRegisterTask(final Context context){mContext=context;}
|
private UserRegisterTask(final Context context){mContext=context;}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(JSONObject result){
|
protected void onPostExecute(JSONObject jsonObject){
|
||||||
try{
|
try{
|
||||||
if(result!=null){
|
if(jsonObject!=null){
|
||||||
if(result.getInt("status") == 200){
|
Intent walletHomeIntent = new Intent(RegisterActivity.this, HomeWalletActivity.class);
|
||||||
System.out.println(result);
|
walletHomeIntent.putExtra("USER_HASH", jsonObject.getString("user_hash"));
|
||||||
Intent accountIntent = new Intent(RegisterActivity.this, UserAccountActivity.class);
|
walletHomeIntent.putExtra("USER_PWD",password.getText().toString());
|
||||||
accountIntent.putExtra("userHash", result.getString("userHash"));
|
walletHomeIntent.putExtra("SESSION_ID",jsonObject.getString("session_id"));
|
||||||
RegisterActivity.this.startActivity(accountIntent);
|
RegisterActivity.this.startActivity(walletHomeIntent);
|
||||||
finish();
|
finish();
|
||||||
}else{
|
|
||||||
Toast.makeText(mContext, result.getString("response"), Toast.LENGTH_SHORT).show();
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
Toast.makeText(mContext, "AN ERROR OCCURED", Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
@ -132,9 +131,8 @@ public class RegisterActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected JSONObject doInBackground(User... users) {
|
protected JSONObject doInBackground(User... users) {
|
||||||
try{
|
try{
|
||||||
String url = Config.USER_REGISTER;
|
UserApiHandler userApiHandler = new UserApiHandler();
|
||||||
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
return userApiHandler.registerUser(users[0]);
|
||||||
return new JSONObject(httpCallHandler.executeRegisterHttp(url,users[0]));
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class HttpCallHandler {
|
||||||
while ((line = bufferedReader.readLine())!=null){
|
while ((line = bufferedReader.readLine())!=null){
|
||||||
stringBuilder.append(line);
|
stringBuilder.append(line);
|
||||||
}
|
}
|
||||||
|
stringBuilder.append("{\"status\":"+200+"}");
|
||||||
returnValue = stringBuilder.toString();
|
returnValue = stringBuilder.toString();
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
package monnethic.mobile.restApi;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import monnethic.mobile.database.User;
|
||||||
|
|
||||||
|
public class UserApiHandler {
|
||||||
|
|
||||||
|
public JSONObject registerUser(User u){ //return JSON with session ID
|
||||||
|
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||||
|
try{
|
||||||
|
String url = Config.USER_REGISTER;
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
|
||||||
|
map.put("name",u.getName());
|
||||||
|
map.put("firstname",u.getFirstname());
|
||||||
|
map.put("email",u.getEmail());
|
||||||
|
map.put("phone",u.getPhone());
|
||||||
|
map.put("association",u.getAssociation());
|
||||||
|
map.put("password",u.getPassword());
|
||||||
|
|
||||||
|
String responseCall = httpCallHandler.postHttp(new URL(url), map);
|
||||||
|
JSONObject jsonObject = new JSONObject(responseCall);
|
||||||
|
u.setUser_hash(jsonObject.getString("user_hash"));
|
||||||
|
|
||||||
|
JSONObject jsonReturn = new JSONObject();
|
||||||
|
jsonReturn.put("user_hash",u.getUser_hash());
|
||||||
|
//jsonReturn.put("session_id",jsonObject.getString("session_id")); //TODO
|
||||||
|
jsonReturn.put("session_id",jsonObject.getString("0"));
|
||||||
|
|
||||||
|
return jsonReturn;
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject loginUser(User u){ //return JSON with session ID
|
||||||
|
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||||
|
try{
|
||||||
|
String url = Config.USER_LOGIN;
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("email",u.getEmail());
|
||||||
|
map.put("password",u.getPassword());
|
||||||
|
|
||||||
|
String responseCall = httpCallHandler.postHttp(new URL(url), map);
|
||||||
|
JSONObject jsonObject = new JSONObject(responseCall);
|
||||||
|
u.setUser_hash(jsonObject.getString("user_hash"));
|
||||||
|
|
||||||
|
|
||||||
|
JSONObject jsonReturn = new JSONObject();
|
||||||
|
jsonReturn.put("status",jsonObject.getString("status"));
|
||||||
|
jsonReturn.put("user_hash",u.getUser_hash());
|
||||||
|
//jsonReturn.put("session_id",jsonObject.getString("session_id")); //TODO
|
||||||
|
jsonReturn.put("session_id",jsonObject.getString("0"));
|
||||||
|
|
||||||
|
return jsonReturn;
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean checkUser(String email){
|
||||||
|
HttpCallHandler httpCallHandler = new HttpCallHandler();
|
||||||
|
Boolean response=false;
|
||||||
|
try{
|
||||||
|
String url = Config.USER_GET+"?user_email="+email;
|
||||||
|
String responseCall = httpCallHandler.getHttp(new URL(url));
|
||||||
|
response = new JSONObject(responseCall).getBoolean("response");
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -31,7 +31,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/textView9"
|
android:layout_below="@+id/textView9"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="65dp"
|
android:layout_marginTop="25dp"
|
||||||
|
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Name"
|
android:hint="Name"
|
||||||
|
@ -72,11 +72,22 @@
|
||||||
android:inputType="textEmailAddress" />
|
android:inputType="textEmailAddress" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/inputPassword"
|
android:id="@+id/inputPhone"
|
||||||
android:layout_width="250dp"
|
android:layout_width="250dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@+id/inputConfEmail"
|
android:layout_below="@+id/inputConfEmail"
|
||||||
android:layout_alignStart="@+id/inputConfEmail"
|
android:layout_alignStart="@+id/inputConfEmail"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:hint="Phone"
|
||||||
|
android:inputType="phone" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/inputPassword"
|
||||||
|
android:layout_width="250dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/inputPhone"
|
||||||
|
android:layout_alignStart="@+id/inputPhone"
|
||||||
android:layout_marginTop="13dp"
|
android:layout_marginTop="13dp"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Password"
|
android:hint="Password"
|
||||||
|
@ -96,8 +107,8 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="40dp"
|
android:layout_marginTop="20dp"
|
||||||
android:layout_marginBottom="20dp">
|
android:layout_marginBottom="40dp">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/buttonOk"
|
android:id="@+id/buttonOk"
|
||||||
|
|
Loading…
Reference in a new issue