fixed password length

This commit is contained in:
IvanaE 2018-11-08 11:43:43 -05:00
parent e37019dd41
commit 21359e5aaf
2 changed files with 2 additions and 2 deletions

View file

@ -33,7 +33,7 @@ public class SignUp extends AppCompatActivity {
String lastname = ((EditText) findViewById(R.id.LastNameInput)).getText().toString(); String lastname = ((EditText) findViewById(R.id.LastNameInput)).getText().toString();
MaterialSpinner spinner = findViewById(R.id.RoleInput); MaterialSpinner spinner = findViewById(R.id.RoleInput);
//TODO add message conditional to check if every EditText is filled up to standards //TODO add message conditional to check if every EditText is filled up to standards
if(username.length()>=5 && password.length()>5 && firstname.length()>0 && lastname.length()>0 && username.matches("[a-zA-Z0-9]*") && password.matches("[a-zA-Z0-9]*") if(username.length()>=5 && password.length()>=5 && firstname.length()>0 && lastname.length()>0 && username.matches("[a-zA-Z0-9]*") && password.matches("[a-zA-Z0-9]*")
&& firstname.matches("[a-zA-Z]*") && lastname.matches("[a-zA-Z]*")){ && firstname.matches("[a-zA-Z]*") && lastname.matches("[a-zA-Z]*")){
switch(spinner.getText().toString()){ switch(spinner.getText().toString()){
case "Home Owner": case "Home Owner":
@ -60,7 +60,7 @@ public class SignUp extends AppCompatActivity {
else if(firstname.length()==0 || lastname.length()==0 || username.length()==0 || password.length()==0){ else if(firstname.length()==0 || lastname.length()==0 || username.length()==0 || password.length()==0){
Toast.makeText(this, "Fields cannot be empty", Toast.LENGTH_LONG).show(); Toast.makeText(this, "Fields cannot be empty", Toast.LENGTH_LONG).show();
} }
else if (username.length()<=5 || password.length()<=5 ){ else if (username.length()<5 || password.length()<5 ){
Toast.makeText(this, "Password and username must be longer than 4 characters", Toast.LENGTH_LONG).show(); Toast.makeText(this, "Password and username must be longer than 4 characters", Toast.LENGTH_LONG).show();
} }
else{ else{