Commit 176d5661 authored by Sam's avatar Sam

Commit v9

parent ab77178b
...@@ -106,6 +106,11 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -106,6 +106,11 @@ public class register extends AppCompatActivity implements View.OnClickListener
setParams(ErrorMessageFirstname); setParams(ErrorMessageFirstname);
ErrorMessageFirstname.setText(message); ErrorMessageFirstname.setText(message);
} }
else if(!firstname.matches("[a-zA-Z]*")){
message = getString(R.string.regex_name);
setParams(ErrorMessageFirstname);
ErrorMessageFirstname.setText(message);
}
else{ else{
ResetParams(ErrorMessageFirstname); ResetParams(ErrorMessageFirstname);
} }
...@@ -114,6 +119,11 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -114,6 +119,11 @@ public class register extends AppCompatActivity implements View.OnClickListener
setParams(ErrorMessageLastname); setParams(ErrorMessageLastname);
ErrorMessageLastname.setText(message); ErrorMessageLastname.setText(message);
} }
else if(!lastname.matches("[a-zA-Z]*")){
message = getString(R.string.regex_name);
setParams(ErrorMessageLastname);
ErrorMessageLastname.setText(message);
}
else{ else{
ResetParams(ErrorMessageLastname); ResetParams(ErrorMessageLastname);
} }
...@@ -123,11 +133,12 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -123,11 +133,12 @@ public class register extends AppCompatActivity implements View.OnClickListener
setParams(ErrorMessageuserName); setParams(ErrorMessageuserName);
ErrorMessageuserName.setText(message); ErrorMessageuserName.setText(message);
} }
else if(username.length() > 30){ else if(!username.matches("[a-zA-Z0-9]*")){
message = getString(R.string.reister_username); message = getString(R.string.regex_other);
setParams(ErrorMessageuserName); setParams(ErrorMessageuserName);
ErrorMessageuserName.setText(message); ErrorMessageuserName.setText(message);
} }
else{ else{
ResetParams(ErrorMessageuserName); ResetParams(ErrorMessageuserName);
} }
...@@ -136,6 +147,11 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -136,6 +147,11 @@ public class register extends AppCompatActivity implements View.OnClickListener
setParams(ErrorMessagepassword); setParams(ErrorMessagepassword);
ErrorMessagepassword.setText(message); ErrorMessagepassword.setText(message);
} }
else if(!password.matches("[a-zA-Z0-9]*")){
message = getString(R.string.regex_other);
setParams(ErrorMessagepassword);
ErrorMessagepassword.setText(message);
}
else{ else{
ResetParams(ErrorMessagepassword); ResetParams(ErrorMessagepassword);
} }
...@@ -174,9 +190,7 @@ public class register extends AppCompatActivity implements View.OnClickListener ...@@ -174,9 +190,7 @@ public class register extends AppCompatActivity implements View.OnClickListener
password_EditText2.setText(""); password_EditText2.setText("");
} }
else if(response.equals("special_characters")){
snackbarAlert("Please remove special Characters", true);
}
else if (response.equals("failure")) { else if (response.equals("failure")) {
snackbarAlert("Something Went Wrong!", true); snackbarAlert("Something Went Wrong!", true);
} else if (response.equals("username_taken")) { } else if (response.equals("username_taken")) {
......
...@@ -86,4 +86,6 @@ ...@@ -86,4 +86,6 @@
<string name="bookingConfirm2">Daté:</string> <string name="bookingConfirm2">Daté:</string>
<string name="bookingConfirm3">Temps:</string> <string name="bookingConfirm3">Temps:</string>
<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_other">* Ne peut contenir que des chiffres et des lettres</string>
</resources> </resources>
\ No newline at end of file
...@@ -82,6 +82,8 @@ ...@@ -82,6 +82,8 @@
<string name="login_usernameError">*Name has to be 5 characters long</string> <string name="login_usernameError">*Name has to be 5 characters long</string>
<string name="login_passwordError">*Password has to be 7 characters long</string> <string name="login_passwordError">*Password has to be 7 characters long</string>
<string name="reister_firstname">*Firstname has to be at least 2 characters long</string> <string name="reister_firstname">*Firstname has to be at least 2 characters long</string>
<string name="regex_name">*Can only contain 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="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>
...@@ -90,4 +92,6 @@ ...@@ -90,4 +92,6 @@
<string name="world_museums">World Museums</string> <string name="world_museums">World Museums</string>
</resources> </resources>
\ No newline at end of file
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