Updated Login activity

updated login activity on new structure (InputController)
This commit is contained in:
GME 2018-09-25 10:38:06 +02:00
parent 8a78eda50d
commit 0e3f52c91c
3 changed files with 21 additions and 19 deletions

View file

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

View file

@ -64,7 +64,7 @@ public class RegisterActivity extends AppCompatActivity {
}
//TODO INSERT VALIDE USER INTO LDAP
public void insertUserLdap(User u){
private void insertUserLdap(User u){
//CHECK IF USER ALREADY EXIST
//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
//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();
}else {
Toast.makeText(this, "INSERT", Toast.LENGTH_SHORT).show();
@ -83,7 +83,7 @@ public class RegisterActivity extends AppCompatActivity {
}
//TODO LAUNCH WALLET ACTIVITY
public void launchWalletActivity(int ldapId){
private void launchWalletActivity(int ldapId){
//LAUNCH APP WALLET WITH ID USER
Intent walletIntent = new Intent(RegisterActivity.this, WalletActivity.class);
walletIntent.putExtra("idUser", ldapId);
@ -91,12 +91,6 @@ public class RegisterActivity extends AppCompatActivity {
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(){
if(InputController.isEmptyEdit(name)){
Toast.makeText(this, "You did not enter your name", Toast.LENGTH_SHORT).show();