Fix major update integrating with external wisemapping frond end

This commit is contained in:
Paulo Gustavo Veiga
2021-12-24 18:03:23 -08:00
parent 76ff1cc83d
commit b3e26caee4
1042 changed files with 1160 additions and 73432 deletions

View File

@@ -18,9 +18,9 @@
package com.wisemapping.validator;
import com.wisemapping.model.Constants;
import com.wisemapping.model.Mindmap;
import com.wisemapping.model.User;
import com.wisemapping.model.Constants;
import com.wisemapping.service.MindmapService;
import com.wisemapping.view.MindMapInfoBean;
import org.jetbrains.annotations.NotNull;

View File

@@ -25,6 +25,6 @@ public interface Messages {
String IMPORT_MAP_ERROR = "IMPORT_MAP_ERROR";
String MAP_TITLE_ALREADY_EXISTS = "MAP_TITLE_ALREADY_EXISTS";
String LABEL_TITLE_ALREADY_EXISTS = "LABEL_TITLE_ALREADY_EXISTS";
String PASSWORD_MISSMATCH = "PASSWORD_MISSMATCH";
String PASSWORD_MISMATCH = "PASSWORD_MISMATCH";
String CAPTCHA_LOADING_ERROR = "CAPTCHA_LOADING_ERROR";
}

View File

@@ -18,10 +18,10 @@
package com.wisemapping.validator;
import com.wisemapping.service.RecaptchaService;
import com.wisemapping.model.Constants;
import com.wisemapping.rest.model.RestUserRegistration;
import com.wisemapping.service.UserService;
import com.wisemapping.view.UserBean;
import com.wisemapping.model.Constants;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.validation.Errors;
@@ -32,15 +32,12 @@ public class UserValidator
implements Validator {
private UserService userService;
private RecaptchaService captchaService;
public boolean supports(final Class clazz) {
return clazz.equals(UserBean.class);
}
public void validate(@Nullable Object obj, @NotNull Errors errors) {
UserBean user = (UserBean) obj;
RestUserRegistration user = (RestUserRegistration) obj;
if (user == null) {
errors.rejectValue("user", "error.not-specified");
} else {
@@ -59,7 +56,6 @@ public class UserValidator
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstname", Messages.FIELD_REQUIRED);
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastname", Messages.FIELD_REQUIRED);
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", Messages.FIELD_REQUIRED);
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "retypePassword", Messages.FIELD_REQUIRED);
ValidatorUtils.rejectIfExceeded(errors,
"firstname",
"The firstname must have less than " + Constants.MAX_USER_FIRSTNAME_LENGTH + " characters.",
@@ -75,28 +71,10 @@ public class UserValidator
"The password must have less than " + Constants.MAX_USER_PASSWORD_LENGTH + " characters.",
user.getPassword(),
Constants.MAX_USER_PASSWORD_LENGTH);
ValidatorUtils.rejectIfExceeded(errors,
"retypePassword",
"The retypePassword must have less than " + Constants.MAX_USER_PASSWORD_LENGTH + " characters.",
user.getRetypePassword(),
Constants.MAX_USER_PASSWORD_LENGTH);
final String password = user.getPassword();
if (password != null && !password.equals(user.getRetypePassword())) {
errors.rejectValue("password", Messages.PASSWORD_MISSMATCH);
}
}
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public void setCaptchaService(@NotNull final RecaptchaService captchaService) {
this.captchaService = captchaService;
}
public RecaptchaService getCaptchaService() {
return captchaService;
}
}

View File

@@ -22,13 +22,13 @@ import org.jetbrains.annotations.Nullable;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
final public class Utils {
//Set the email emailPattern string
static private Pattern emailPattern = Pattern.compile(".+@.+\\.[a-z]+");
static private final Pattern emailPattern = Pattern.compile(".+@.+\\.[a-z]+");
private Utils() {