mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-24 23:17:56 +01:00
Improve exception un invalid email
This commit is contained in:
parent
20a9978577
commit
0ee642c246
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -243,7 +243,7 @@ public class MindmapController extends BaseController {
|
|||||||
|
|
||||||
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/collabs/", consumes = {"application/json", "application/xml"}, produces = {"application/json", "application/xml"})
|
@RequestMapping(method = RequestMethod.POST, value = "/maps/{id}/collabs/", consumes = {"application/json", "application/xml"}, produces = {"application/json", "application/xml"})
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@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);
|
final Mindmap mindMap = findMindmapById(id);
|
||||||
|
|
||||||
// Only owner can change collaborators...
|
// Only owner can change collaborators...
|
||||||
@ -259,7 +259,7 @@ public class MindmapController extends BaseController {
|
|||||||
|
|
||||||
// Is a valid email address ?
|
// Is a valid email address ?
|
||||||
if (!EmailValidator.getInstance().isValid(email)) {
|
if (!EmailValidator.getInstance().isValid(email)) {
|
||||||
throw new IllegalArgumentException(email + " is not valid email address");
|
throw new InvalidEmailException(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Collaboration collaboration = mindMap.findCollaboration(email);
|
final Collaboration collaboration = mindMap.findCollaboration(email);
|
||||||
@ -269,7 +269,7 @@ public class MindmapController extends BaseController {
|
|||||||
throw new IllegalArgumentException(roleStr + " is not a valid role");
|
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) {
|
if (collaboration != null) {
|
||||||
collabsToRemove.remove(collaboration);
|
collabsToRemove.remove(collaboration);
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ public class MindmapController extends BaseController {
|
|||||||
// Is a valid email address ?
|
// Is a valid email address ?
|
||||||
final EmailValidator emailValidator = EmailValidator.getInstance();
|
final EmailValidator emailValidator = EmailValidator.getInstance();
|
||||||
if (!emailValidator.isValid(email)) {
|
if (!emailValidator.isValid(email)) {
|
||||||
throw new IllegalArgumentException(email + " is not valid email address");
|
throw new InvalidEmailException(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Mindmap mindmap = findMindmapById(id);
|
final Mindmap mindmap = findMindmapById(id);
|
||||||
|
@ -4,6 +4,7 @@ SITE.TITLE = WiseMapping
|
|||||||
FIELD_REQUIRED = Required field cannot be left blank
|
FIELD_REQUIRED = Required field cannot be left blank
|
||||||
EMAIL_ALREADY_EXIST = There is an account already with this email.
|
EMAIL_ALREADY_EXIST = There is an account already with this email.
|
||||||
NO_VALID_EMAIL_ADDRESS = Invalid email address
|
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
|
PASSWORD_MISMATCH = Your password entries did not match
|
||||||
CREATOR = Creator
|
CREATOR = Creator
|
||||||
WELCOME = Welcome
|
WELCOME = Welcome
|
||||||
|
Loading…
Reference in New Issue
Block a user