Commit f80338d9 authored by Sam's avatar Sam

FINAL VERSION

parent 8e799fbd
...@@ -137,6 +137,10 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -137,6 +137,10 @@ public class register extends AppCompatActivity implements View.OnClickListener
message = getString(R.string.regex_other); message = getString(R.string.regex_other);
setParams(ErrorMessageuserName); setParams(ErrorMessageuserName);
ErrorMessageuserName.setText(message); ErrorMessageuserName.setText(message);
} else if(username.contains(lastname) || username.contains(firstname)){
message = getString(R.string.register_username_contain);
setParams(ErrorMessageuserName);
ErrorMessageuserName.setText(message);
} }
else{ else{
...@@ -165,7 +169,7 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -165,7 +169,7 @@ public class register extends AppCompatActivity implements View.OnClickListener
else{ else{
ResetParams(ErrorMessagepassword2); ResetParams(ErrorMessagepassword2);
} }
if(password.matches("[a-zA-Z0-9]*") && username.matches("[a-zA-Z0-9]*")&& lastname.matches("[a-zA-Z]*") && firstname.matches("[a-zA-Z]*") && password.equals(password2) && password2.length() >= 7 && password.length() >= 7 && username.length() >= 5 && lastname.length() >= 3 && firstname.length() >= 2) { if(!username.contains(lastname) && !username.contains(firstname) && password.matches("[a-zA-Z0-9]*") && username.matches("[a-zA-Z0-9]*")&& lastname.matches("[a-zA-Z]*") && firstname.matches("[a-zA-Z]*") && password.equals(password2) && password2.length() >= 7 && password.length() >= 7 && username.length() >= 5 && lastname.length() >= 3 && firstname.length() >= 2) {
firstname = firstname.substring(0,1).toUpperCase() + firstname.substring(1); firstname = firstname.substring(0,1).toUpperCase() + firstname.substring(1);
lastname = lastname.substring(0,1).toUpperCase() + lastname.substring(1); lastname = lastname.substring(0,1).toUpperCase() + lastname.substring(1);
...@@ -181,7 +185,6 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -181,7 +185,6 @@ public class register extends AppCompatActivity implements View.OnClickListener
StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, (Response.Listener<String>) response -> { StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, (Response.Listener<String>) response -> {
if (response.equals("success")) { if (response.equals("success")) {
snackbarAlert("You have successfully registered the account!", false); snackbarAlert("You have successfully registered the account!", false);
......
...@@ -88,4 +88,5 @@ ...@@ -88,4 +88,5 @@
<string name="bookingTitle">Confirmer la réservation</string> <string name="bookingTitle">Confirmer la réservation</string>
<string name="regex_name">* Ne peut contenir que des lettres</string> <string name="regex_name">* Ne peut contenir que des lettres</string>
<string name="regex_other">* Ne peut contenir que des chiffres et des lettres</string> <string name="regex_other">* Ne peut contenir que des chiffres et des lettres</string>
<string name="register_username_contain">* Le nom d\'utilisateur ne peut pas contenir votre prénom ou votre nom</string>
</resources> </resources>
\ No newline at end of file
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
<string name="regex_other">*Can only contain numbers and letters</string> <string name="regex_other">*Can only contain numbers and letters</string>
<string name="reister_lastname">*Lastname has to be at least 3 characters long</string> <string name="reister_lastname">*Lastname has to be at least 3 characters long</string>
<string name="reister_username">*Username has to be at least 5 characters long</string> <string name="reister_username">*Username has to be at least 5 characters long</string>
<string name="register_username_contain">*Username cannot contain your first or last name</string>
<string name="reister_password">*Password has to be at least 7 characters long</string> <string name="reister_password">*Password has to be at least 7 characters long</string>
<string name="reister_password2">*Passwords do not match</string> <string name="reister_password2">*Passwords do not match</string>
<string name="date_goes_here">Date goes here</string> <string name="date_goes_here">Date goes here</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment