Merge branch 'master' of github.com:metersphere/metersphere into Ambitiousliga-confirm-pwd

This commit is contained in:
chenjianxing 2021-03-18 17:33:18 +08:00
commit a9d5c70e04
20 changed files with 128 additions and 36 deletions

View File

@ -46,6 +46,12 @@ public class MsJSR223Processor extends MsTestElement {
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
processor.setProperty("cacheKey", "true");
processor.setProperty("scriptLanguage", this.getScriptLanguage());
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) {
processor.setProperty("scriptLanguage", "nashorn");
}
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("graalVMScript")) {
processor.setProperty("scriptLanguage", "javascript");
}
processor.setProperty("script", this.getScript());
final HashTree jsr223PreTree = tree.add(processor);

View File

@ -40,6 +40,12 @@ public class MsJSR223PostProcessor extends MsTestElement {
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
processor.setProperty("cacheKey", "true");
processor.setProperty("scriptLanguage", this.getScriptLanguage());
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) {
processor.setProperty("scriptLanguage", "nashorn");
}
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("graalVMScript")) {
processor.setProperty("scriptLanguage", "javascript");
}
processor.setProperty("script", this.getScript());
final HashTree jsr223PostTree = tree.add(processor);

View File

@ -12,6 +12,7 @@ import org.apache.jmeter.modifiers.JSR223PreProcessor;
import org.apache.jmeter.save.SaveService;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jorphan.collections.HashTree;
import org.graalvm.polyglot.Context;
import java.util.List;
@ -38,6 +39,8 @@ public class MsJSR223PreProcessor extends MsTestElement {
}
public JSR223PreProcessor getJSR223PreProcessor() {
Context.newBuilder().allowNativeAccess(true).build();
JSR223PreProcessor processor = new JSR223PreProcessor();
processor.setEnabled(this.isEnable());
if (StringUtils.isNotEmpty(this.getName())) {
@ -49,6 +52,13 @@ public class MsJSR223PreProcessor extends MsTestElement {
processor.setProperty(TestElement.GUI_CLASS, SaveService.aliasToClass("TestBeanGUI"));
processor.setProperty("cacheKey", "true");
processor.setProperty("scriptLanguage", this.getScriptLanguage());
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("nashornScript")) {
processor.setProperty("scriptLanguage", "nashorn");
}
if (StringUtils.isNotEmpty(this.getScriptLanguage()) && this.getScriptLanguage().equals("graalVMScript")) {
processor.setProperty("scriptLanguage", "javascript");
}
processor.setProperty("script", this.getScript());
return processor;
}

View File

@ -332,8 +332,10 @@ public class ApiAutomationService {
public ApiScenarioDTO getApiScenario(String id) {
ApiScenarioDTO apiScenarioDTO = new ApiScenarioDTO();
ApiScenarioWithBLOBs scenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(id);
BeanUtils.copyBean(apiScenarioDTO, scenarioWithBLOBs);
setApiScenarioProjectIds(apiScenarioDTO);
if (scenarioWithBLOBs != null) {
BeanUtils.copyBean(apiScenarioDTO, scenarioWithBLOBs);
setApiScenarioProjectIds(apiScenarioDTO);
}
return apiScenarioDTO;
}

View File

@ -35,7 +35,7 @@ public class RestControllerExceptionHandler {
@ExceptionHandler(SQLException.class)
public ResultHolder sqlExceptionHandler(HttpServletRequest request, HttpServletResponse response, SQLException e) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
LogUtil.error(e);
LogUtil.error(e.getMessage(), e);
return ResultHolder.error("SQL error happened, please check logs.");
}

View File

@ -20,7 +20,7 @@ public class LoginRequest {
try {
RsaKey rsaKey = CommonBeanFactory.getBean(RsaKey.class);
return RsaUtil.privateDecrypt(username, rsaKey.getPrivateKey());
} catch (NoSuchAlgorithmException e) {
} catch (Exception e) {
return username;
}
}
@ -29,7 +29,7 @@ public class LoginRequest {
try {
RsaKey rsaKey = CommonBeanFactory.getBean(RsaKey.class);
return RsaUtil.privateDecrypt(password, rsaKey.getPrivateKey());
} catch (NoSuchAlgorithmException e) {
} catch (Exception e) {
return password;
}
}

View File

@ -14,7 +14,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController

View File

@ -377,7 +377,7 @@ public class TestCaseReviewService {
sqlSession.flushStatements();
//同步添加关联的接口和测试用例
if(request.getChecked()){
/* if(request.getChecked()){
if (!testCaseIds.isEmpty()) {
testCaseIds.forEach(caseId -> {
TestCaseWithBLOBs testDtail=testCaseMapper.selectByPrimaryKey(caseId);
@ -434,7 +434,7 @@ public class TestCaseReviewService {
});
}
}
}*/
TestCaseReview testCaseReview = testCaseReviewMapper.selectByPrimaryKey(request.getReviewId());
if (StringUtils.equals(testCaseReview.getStatus(), TestCaseReviewStatus.Prepare.name())
|| StringUtils.equals(testCaseReview.getStatus(), TestCaseReviewStatus.Completed.name())) {

@ -1 +1 @@
Subproject commit efd6af73b7c5cc53cd4515772000bc1436c49837
Subproject commit adefde265ff12d4ea909353c3f46008f8a8e17e7

View File

@ -72,13 +72,14 @@
],
isCodeEditAlive: true,
languages: [
'beanshell', "python", "groovy", "javascript"
'beanshell', "python", "groovy", "nashornScript","graalVMScript"
],
codeEditModeMap: {
beanshell: 'java',
python: 'python',
groovy: 'java',
javascript: 'javascript',
nashornScript: 'javascript',
graalVMScript: 'javascript',
}
}
},

View File

@ -2,7 +2,7 @@
<div>
<el-row :gutter="10" type="flex" justify="space-between" align="middle">
<el-col>
<el-input :disabled="isReadOnly" v-model="xPath2.expression" maxlength="200" size="small" show-word-limit
<el-input :disabled="isReadOnly" v-model="xPath2.expression" maxlength="500" size="small" show-word-limit
:placeholder="$t('api_test.request.extract.xpath_expression')"/>
</el-col>
<el-col class="assertion-btn">

View File

@ -222,7 +222,9 @@
}
this.result = this.$post("/api/testcase/list", this.condition, response => {
this.apiCaseList = response.data;
if(response.data){
this.apiCaseList = response.data;
}
this.apiCaseList.forEach(apiCase => {
if (apiCase.tags && apiCase.tags.length > 0) {
apiCase.tags = JSON.parse(apiCase.tags);
@ -236,7 +238,7 @@
}
})
if (!this.useEnvironment && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
if (!this.useEnvironment && this.apiCaseList[0] && this.apiCaseList[0].request && this.apiCaseList[0].request.useEnvironment) {
this.useEnvironment = this.apiCaseList[0].request.useEnvironment;
this.environment = this.useEnvironment;
}

View File

@ -1,6 +1,7 @@
<template>
<el-dialog :close-on-click-modal="false" :title="$t('api_test.api_import.title')" width="30%"
:visible.sync="visible" class="api-import" v-loading="result.loading" @close="close">
:visible.sync="visible" class="api-import" v-loading="result.loading" @close="close"
:destroy-on-close="true">
<div class="header-bar">
<div>{{ $t('api_test.api_import.data_format') }}</div>
@ -23,12 +24,12 @@
<el-form :model="formData" :rules="rules" label-width="100px" v-loading="result.loading" ref="form">
<el-row>
<el-col :span="11">
<el-form-item :label="$t('commons.import_module')">
<el-form-item :label="$t('commons.import_module')" prop="moduleId">
<el-select size="small" v-model="formData.moduleId" class="project-select" clearable>
<el-option v-for="item in moduleOptions" :key="item.id" :label="item.path" :value="item.id"/>
</el-select>
</el-form-item>
<el-form-item v-if="!isScenarioModel&&!isHar" :label="$t('commons.import_mode')">
<el-form-item v-if="!isScenarioModel&&!isHar" :label="$t('commons.import_mode')" prop="modeId">
<el-select size="small" v-model="formData.modeId" class="project-select" clearable>
<el-option v-for="item in modeOptions" :key="item.id" :label="item.name" :value="item.id"/>
</el-select>
@ -167,7 +168,14 @@ export default {
modeId: this.$t('commons.not_cover'),
moduleId: '',
},
rules: {},
rules: {
modeId: [
{required: true, message: this.$t('commons.please_select_import_mode'), trigger: 'change'},
],
moduleId: [
{required: true, message: this.$t('commons.please_select_import_module'), trigger: 'change'},
],
},
currentModule: {},
fileList: []
}

View File

@ -524,7 +524,8 @@ export default {
this.$emit('editApi', row);
},
runApi(row) {
let request = JSON.parse(row.request);
let request = row ? JSON.parse(row.request) : {};
if (row.tags instanceof Array) {
row.tags = JSON.stringify(row.tags);
}

View File

@ -1,6 +1,6 @@
<template>
<el-dialog title="表头显示字段" :visible.sync="dialogTableVisible" :append-to-body="true">
<tree-transfer :title="['待选字段', '已选字段']"
<el-dialog :title="$t('table.header_display_field')" :visible.sync="dialogTableVisible" :append-to-body="true">
<tree-transfer :title="[$t('table.fields_to_be_selected'), $t('table.selected_fields')]"
:from_data='optionalFields'
:draggable="true"
:to_data='fieldSelected'

View File

@ -330,6 +330,9 @@
<el-form-item :label="$t('member.new_password')" prop="newpassword">
<el-input type="password" v-model="ruleForm.newpassword" autocomplete="off" show-password></el-input>
</el-form-item>
<el-form-item :label="$t('member.repeat_password')" prop="confirmpassword">
<el-input type="password" v-model="ruleForm.confirmpassword" autocomplete="off" show-password></el-input>
</el-form-item>
<el-form-item>
<el-input v-model="ruleForm.id" autocomplete="off" :disabled="true" style="display:none"/>
</el-form-item>
@ -385,6 +388,15 @@ export default {
ShowMoreBtn
},
data() {
const validateConfirmPwd = (rule, value, callback) => {
if(value === ''){
callback(new Error(this.$t('user.input_password')));
}else if((value !== this.ruleForm.newpassword)){
callback(new Error(this.$t('member.inconsistent_passwords')));
}else{
callback();
}
};
return {
referenced: false,
queryPath: '/user/special/list',
@ -479,7 +491,17 @@ export default {
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
}
],
confirmpassword: [
{
required: true,
pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,30}$/,
message: this.$t('member.password_format_is_incorrect'),
trigger: 'blur'
},
{trigger: ['blur', 'change'], validator: validateConfirmPwd}
]
}
}
},

View File

@ -136,12 +136,12 @@
<el-row>
<el-col :span="10">
<el-form-item label="关联需求" :label-width="formLabelWidth" prop="demandId">
<el-select filterable :disabled="readOnly" v-model="form.demandId"
:placeholder="$t('test_track.case.input_type')" class="ms-case-input">
<el-select filterable :disabled="readOnly" v-model="form.demandId" @visible-change="visibleChange"
placeholder="请选择要关联的需求" class="ms-case-input">
<el-option
v-for="item in demandOptions"
:key="item.id"
:label="item.name"
:label="item.platform + ': '+item.name"
:value="item.id">
</el-option>
</el-select>
@ -761,18 +761,31 @@ export default {
});
}
},
visibleChange(flag) {
if (flag) {
this.getDemandOptions();
}
},
getDemandOptions() {
this.projectId = getCurrentProjectID()
this.result = this.$get("demand/list/" + this.projectId, response => {
this.demandOptions = response.data;
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other')})
});
if (this.demandOptions.length === 0) {
this.projectId = getCurrentProjectID();
this.result = {loading : true};
this.$get("demand/list/" + this.projectId).then(response => {
this.demandOptions = response.data.data;
this.demandOptions.unshift({id: 'other', name: this.$t('test_track.case.other'), platform: 'Other'})
this.result = {loading : false};
}).catch(() => {
this.result = {loading : false};
})
}
},
getSelectOptions() {
this.getModuleOptions();
this.getMaintainerOptions();
this.getTestOptions();
// this.getDemandOptions()
if (this.type === 'edit') {
this.getDemandOptions();
}
},
resetForm() {

View File

@ -1,7 +1,9 @@
export default {
commons: {
pass_rate:'Pass rate',
execution_times:'Execution times',
please_select_import_mode: 'Please select import mode',
please_select_import_module: 'Please select import module',
pass_rate: 'Pass rate',
execution_times: 'Execution times',
cover: 'Cover',
not_cover: 'Not Cover',
import: 'Import',
@ -1608,5 +1610,10 @@ export default {
delete_prompt: 'This operation will delete the authentication source, do you want to continue? ',
title: 'Auth Source',
auth_name_valid: 'Name does not support special characters',
},
table: {
header_display_field: 'Header display field',
fields_to_be_selected: 'Fields to be selected',
selected_fields: 'Selected fields'
}
};

View File

@ -1,7 +1,9 @@
export default {
commons: {
pass_rate:'通过率',
execution_times:'执行次数',
please_select_import_mode: '请选择导入模式',
please_select_import_module: '请选择导入模块',
pass_rate: '通过率',
execution_times: '执行次数',
cover: '覆盖',
not_cover: '不覆盖',
import: '导入',
@ -1611,5 +1613,10 @@ export default {
delete_prompt: '此操作会删除认证源,是否继续?',
title: '认证设置',
auth_name_valid: '名称不支持特殊字符',
},
table: {
header_display_field: '表头显示字段',
fields_to_be_selected: '待选字段',
selected_fields: '已选字段'
}
};

View File

@ -1,7 +1,9 @@
export default {
commons: {
pass_rate:'通過率',
execution_times:'執行次數',
please_select_import_mode: '請選擇導入模式',
please_select_import_module: '請選擇導入模塊',
pass_rate: '通過率',
execution_times: '執行次數',
cover: '覆蓋',
not_cover: '不覆蓋',
import: '導入',
@ -1609,5 +1611,11 @@ export default {
delete_prompt: '此操作會刪除認證源,是否繼續? ',
title: '認證設置',
auth_name_valid: '名稱不支持特殊字符',
},
table: {
header_display_field: '表頭顯示欄位',
fields_to_be_selected: '待選欄位',
selected_fields: '已選欄位'
}
};