/_includes/codeExamples/minitwit/17.validate_user_method.html
https://github.com/sparktutorials/sparktutorials.github.io · HTML · 15 lines · 13 code · 2 blank · 0 comment · 0 complexity · 7de12ef552e1d4a7da07a8ec4865f5c0 MD5 · raw file
- public String validate() {
- String error = null;
-
- if(StringUtils.isEmpty(username)) {
- error = "You have to enter a username";
- } else if(!EMAIL_ADDRESS_REGEX.matcher(email).matches()) {
- error = "You have to enter a valid email address";
- } else if(StringUtils.isEmpty(password)) {
- error = "You have to enter a password";
- } else if(!password.equals(password2)) {
- error = "The two passwords do not match";
- }
-
- return error;
- }