This commit is contained in:
shiziyuan9527 2020-04-29 13:53:26 +08:00
parent aa34d1726b
commit 28a2d25ce0
4 changed files with 19 additions and 8 deletions

View File

@ -15,6 +15,7 @@ import io.metersphere.dto.OrganizationMemberDTO;
import io.metersphere.dto.UserDTO;
import io.metersphere.dto.UserRoleDTO;
import io.metersphere.dto.UserRoleHelpDTO;
import io.metersphere.i18n.Translator;
import io.metersphere.user.SessionUser;
import io.metersphere.user.SessionUtils;
import org.apache.commons.lang3.StringUtils;
@ -54,11 +55,11 @@ public class UserService {
private void checkUserParam(User user) {
if (StringUtils.isBlank(user.getName())) {
MSException.throwException("user_name_empty");
MSException.throwException(Translator.get("user_name_is_null"));
}
if (StringUtils.isBlank(user.getEmail())) {
MSException.throwException("user_email_empty");
MSException.throwException(Translator.get("user_email_is_null"));
}
// password
}
@ -76,7 +77,7 @@ public class UserService {
criteria.andEmailEqualTo(user.getEmail());
List<User> userList = userMapper.selectByExample(userExample);
if (!CollectionUtils.isEmpty(userList)) {
MSException.throwException("user_email_is_exist");
MSException.throwException(Translator.get("user_email_already_exists"));
}
userMapper.insertSelective(user);
}
@ -325,10 +326,10 @@ public class UserService {
public boolean checkUserPassword(String userId, String password) {
if (StringUtils.isBlank(userId)) {
MSException.throwException("Username cannot be null");
MSException.throwException(Translator.get("user_name_is_null"));
}
if (StringUtils.isBlank(password)) {
MSException.throwException("Password cannot be null");
MSException.throwException(Translator.get("password_is_null"));
}
UserExample example = new UserExample();
example.createCriteria().andIdEqualTo(userId).andPasswordEqualTo(CodingUtil.md5(password));

View File

@ -150,7 +150,7 @@ public class WorkspaceService {
WorkspaceExample example = new WorkspaceExample();
example.createCriteria().andIdEqualTo(workspaceId);
if (workspaceMapper.countByExample(example) == 0) {
MSException.throwException("workspace_not_exist");
MSException.throwException(Translator.get("workspace_not_exists"));
}
}

View File

@ -24,3 +24,8 @@ cannot_edit_load_test_running=Cannot modify the running test
test_not_found=Test cannot be found:
test_not_running=Test is not running
before_delete_plan=There is an associated test case under this plan, please unlink it first!
user_email_already_exists=User email already exists
user_name_is_null=User name cannot be null
user_email_is_null=User email cannot be null
password_is_null=Password cannot be null
workspace_not_exists=Workspace is not exists

View File

@ -24,3 +24,8 @@ cannot_edit_load_test_running=不能修改正在运行的测试
test_not_found=测试不存在:
test_not_running=测试未运行
before_delete_plan=该计划下存在关联测试用例,请先取消关联!
user_email_already_exists=用户邮箱已存在
user_name_is_null=用户名不能为空
user_email_is_null=用户邮箱不能为空
password_is_null=密码不能为空
workspace_not_exists=工作空间不存在