Merge branch 'develop' into feature/lock2

This commit is contained in:
Paulo Gustavo Veiga 2022-03-22 22:09:00 -03:00
commit 63f83e879d
4 changed files with 44 additions and 5 deletions

View File

@ -0,0 +1,39 @@
/*
* Copyright [2022] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.exceptions;
import org.springframework.lang.Nullable;
import javax.validation.constraints.NotNull;
public class InvalidEmailException
extends ClientException {
private static final String EMAIL_IS_INVALID = "INVALID_EMAIL_ADDRESS";
public InvalidEmailException(@NotNull String emails) {
super("Invalid email exception:" + emails, Severity.WARNING);
}
@NotNull
@Override
protected String getMsgBundleKey() {
return EMAIL_IS_INVALID;
}
}

View File

@ -168,7 +168,6 @@ public class User
return "User{" +
"firstname='" + firstname + '\'' +
", lastname='" + lastname + '\'' +
", password='" + password + '\'' +
"', email = '" + this.getEmail() + "}";
}
}

View File

@ -244,7 +244,7 @@ public class MindmapController extends BaseController {
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/collabs/", consumes = {"application/json", "application/xml"}, produces = {"application/json", "application/xml"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException {
public void updateCollabs(@PathVariable int id, @NotNull @RequestBody RestCollaborationList restCollabs) throws CollaborationException, MapCouldNotFoundException, AccessDeniedSecurityException, InvalidEmailException {
final Mindmap mindMap = findMindmapById(id);
// Only owner can change collaborators...
@ -260,7 +260,7 @@ public class MindmapController extends BaseController {
// Is a valid email address ?
if (!EmailValidator.getInstance().isValid(email)) {
throw new IllegalArgumentException(email + " is not valid email address");
throw new InvalidEmailException(email);
}
final Collaboration collaboration = mindMap.findCollaboration(email);
@ -270,7 +270,7 @@ public class MindmapController extends BaseController {
throw new IllegalArgumentException(roleStr + " is not a valid role");
}
// Remove from the list of pendings to remove ...
// Remove from the list of pending to remove ...
if (collaboration != null) {
collabsToRemove.remove(collaboration);
}
@ -408,7 +408,7 @@ public class MindmapController extends BaseController {
// Is a valid email address ?
final EmailValidator emailValidator = EmailValidator.getInstance();
if (!emailValidator.isValid(email)) {
throw new IllegalArgumentException(email + " is not valid email address");
throw new InvalidEmailException(email);
}
final Mindmap mindmap = findMindmapById(id);

View File

@ -4,6 +4,7 @@ SITE.TITLE = WiseMapping
FIELD_REQUIRED = Required field cannot be left blank
EMAIL_ALREADY_EXIST = There is an account already with this email.
NO_VALID_EMAIL_ADDRESS = Invalid email address
INVALID_EMAIL_ADDRESS = Invalid email address. Please, verify that your entered valid email address.
PASSWORD_MISMATCH = Your password entries did not match
CREATOR = Creator
WELCOME = Welcome