Merge branch 'features/homepage/login' into develop

This commit is contained in:
GME 2018-09-25 10:40:00 +02:00
commit 7f3e0fa6a7
3 changed files with 21 additions and 19 deletions

View file

@ -27,4 +27,16 @@ public class InputController {
matcher = pattern.matcher(name); matcher = pattern.matcher(name);
return matcher.matches(); return matcher.matches();
} }
//TODO VERIFY IF INPUTED USER ALREADY EXIST IN LDAP
public static boolean checkUser(String mail){
//Statement stmt = null;
//String query = "SELECT userId FROM USER_TABLE WHERE email="+mail+";";
return false;
}
//TODO CHECK USER AND SEND BACK ID
public static boolean checkUser(String mail, String password){
return true;
}
} }

View file

@ -47,26 +47,22 @@ public class LoginActivity extends AppCompatActivity {
public void onClickForgetEmail(View v){ public void onClickForgetEmail(View v){
Toast.makeText(this, "Forget email", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Forget email", Toast.LENGTH_SHORT).show();
} }
public void validateInput(){ private void validateInput(){
if(InputController.isEmptyEdit(email)){ if(InputController.isEmptyEdit(email)){
Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "You did not enter your email", Toast.LENGTH_SHORT).show();
} else if(!InputController.validEmail(email.getText().toString())){
Toast.makeText(this, "Your email is invalid", Toast.LENGTH_SHORT).show();
} 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(checkUser(email.getText().toString(),password.getText().toString())){ if(InputController.checkUser(email.getText().toString(),password.getText().toString())){
launchWalletActivity(1); launchWalletActivity(1);
}else{ }else{
Toast.makeText(this, "Wrong authentification", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Wrong authentication", Toast.LENGTH_SHORT).show();
} }
} }
} }
public void launchWalletActivity(int ldapId){
//TODO CHECK USER AND SEND BACK ID
private boolean checkUser(String m, String p){
return true;
}
public void launchWalletActivity(int ldapId){;
//LAUNCH APP WALLET WITH ID USER //LAUNCH APP WALLET WITH ID USER
Intent walletIntent = new Intent(LoginActivity.this, WalletActivity.class); Intent walletIntent = new Intent(LoginActivity.this, WalletActivity.class);
walletIntent.putExtra("idUser", ldapId); walletIntent.putExtra("idUser", ldapId);

View file

@ -64,7 +64,7 @@ public class RegisterActivity extends AppCompatActivity {
} }
//TODO INSERT VALIDE USER INTO LDAP //TODO INSERT VALIDE USER INTO LDAP
public void insertUserLdap(User u){ private void insertUserLdap(User u){
//CHECK IF USER ALREADY EXIST //CHECK IF USER ALREADY EXIST
//IF USER DOESN'T EXIST, INSERT USER INTO LDAP //IF USER DOESN'T EXIST, INSERT USER INTO LDAP
@ -74,7 +74,7 @@ public class RegisterActivity extends AppCompatActivity {
//IF SUCCESSFULLY INSERTED INTO LDAP CALL LAUNCHWALLET //IF SUCCESSFULLY INSERTED INTO LDAP CALL LAUNCHWALLET
//TEMPORARY //TEMPORARY
if(checkUser(u.getEmail())){ if(InputController.checkUser(u.getEmail())){
Toast.makeText(this, "User already have an account, please log in", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "User already have an account, please log in", Toast.LENGTH_SHORT).show();
}else { }else {
Toast.makeText(this, "INSERT", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "INSERT", Toast.LENGTH_SHORT).show();
@ -83,7 +83,7 @@ public class RegisterActivity extends AppCompatActivity {
} }
//TODO LAUNCH WALLET ACTIVITY //TODO LAUNCH WALLET ACTIVITY
public void launchWalletActivity(int ldapId){ private void launchWalletActivity(int ldapId){
//LAUNCH APP WALLET WITH ID USER //LAUNCH APP WALLET WITH ID USER
Intent walletIntent = new Intent(RegisterActivity.this, WalletActivity.class); Intent walletIntent = new Intent(RegisterActivity.this, WalletActivity.class);
walletIntent.putExtra("idUser", ldapId); walletIntent.putExtra("idUser", ldapId);
@ -91,12 +91,6 @@ public class RegisterActivity extends AppCompatActivity {
finish(); finish();
} }
//TODO VERIFY IF INPUTED USER ALREADY EXIST IN LDAP
private boolean checkUser(Object mail){
//Statement stmt = null;
//String query = "SELECT userId FROM USER_TABLE WHERE email="+mail+";";
return false;
}
private boolean checkInputEmpty(){ private boolean checkInputEmpty(){
if(InputController.isEmptyEdit(name)){ if(InputController.isEmptyEdit(name)){
Toast.makeText(this, "You did not enter your name", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "You did not enter your name", Toast.LENGTH_SHORT).show();