Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
01aa4ee9
Commit
01aa4ee9
authored
Sep 25, 2023
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '数据库密码密文展示'
parent
a8bdb00d
Pipeline
#79382
passed with stages
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
44 deletions
+54
-44
InitDataBase.jsx
src/pages/database/InitDataBase/InitDataBase.jsx
+28
-30
AppendModal.jsx
src/pages/database/databaseInitialization/AppendModal.jsx
+2
-1
DatabaseInitialization.jsx
...atabase/databaseInitialization/DatabaseInitialization.jsx
+24
-13
No files found.
src/pages/database/InitDataBase/InitDataBase.jsx
View file @
01aa4ee9
...
...
@@ -92,6 +92,10 @@ const InitDataBase = props => {
// 获取数据库配置信息
useEffect
(()
=>
{
// setTimeout(() => {
// document.getElementById('pwd').removeAttribute('value');
// }, 0);
setCardLoading
(
true
);
// 数据库连接记录初始化
getConnRecordData
();
...
...
@@ -105,14 +109,8 @@ const InitDataBase = props => {
Object
.
keys
(
dbForm
).
forEach
(
k
=>
{
obj
[
k
]
=
res
[
k
];
});
console
.
log
(
obj
,
'objohjfaosdjf'
);
console
.
log
(
Decrypt
(
obj
.
password
));
let
aa
=
Decrypt
(
obj
.
password
);
console
.
log
(
Encrypt
(
aa
));
form
.
setFieldsValue
({
...
obj
,
password
:
Decrypt
(
obj
.
password
)
});
setDbForm
(
val
=>
({
...
val
,
...
obj
,
password
:
Decrypt
(
obj
.
password
)
}));
form
.
setFieldsValue
({
...
obj
});
setDbForm
(
val
=>
({
...
val
,
...
obj
}));
setAllSqulDir
(
res
.
allSqlDir
);
if
(
res
.
allSqlDir
.
some
(
item
=>
item
===
inUse
))
{
setDefaultSqlDir
(
res
.
tableSQLDirName
);
...
...
@@ -256,11 +254,12 @@ const InitDataBase = props => {
setCardLoading
(
true
);
const
obj
=
values
;
console
.
log
(
chooseDb
.
current
,
'obj'
);
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
saveConnectionNew
({
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
password
:
Encrypt
(
obj
.
password
)
,
password
:
pwd
,
desc
:
chooseDb
.
current
.
desc
,
})
.
then
(
resnew
=>
{
...
...
@@ -271,7 +270,7 @@ const InitDataBase = props => {
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
password
:
Encrypt
(
obj
.
password
)
,
password
:
pwd
,
});
// setUpData(upData + 1);
getConnRecordData
();
...
...
@@ -295,18 +294,14 @@ const InitDataBase = props => {
};
// 测试连接
const
onCheck
=
e
=>
{
console
.
log
(
dbForm
);
setCardLoading
(
true
);
const
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
connectionTest
({
// _version: 9999,
// _dc: new Date().getTime(),
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
password
:
Encrypt
(
obj
.
password
),
// Type:"SQLServer",
// name:obj.dbName,
password
:
pwd
,
})
.
then
(
res
=>
{
setCardLoading
(
false
);
...
...
@@ -331,18 +326,15 @@ const InitDataBase = props => {
};
// 获取数据库列表
const
selectFocus
=
e
=>
{
//setOption([]);
let
params
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
params
.
password
)
===
''
?
Encrypt
(
params
.
password
)
:
params
.
password
;
getDataBaseList
({
// _version: 9999,
// _dc: Date.now(),
userName
:
params
.
userName
||
''
,
password
:
Encrypt
(
params
.
password
)
||
''
,
password
:
pwd
||
''
,
ip
:
params
.
ip
||
''
,
})
.
then
(
res
=>
{
if
(
res
.
code
==
0
)
{
console
.
log
(
res
.
data
.
root
);
setOption
(
res
.
data
.
root
);
}
else
{
notification
.
error
({
...
...
@@ -364,7 +356,7 @@ const InitDataBase = props => {
obj
[
k
]
=
item
[
k
];
});
chooseDb
.
current
=
item
;
form
.
setFieldsValue
({
...
obj
,
password
:
Decrypt
(
obj
.
password
)
});
form
.
setFieldsValue
({
...
obj
});
};
// 产品方案选择框回调
const
handleSelect
=
value
=>
{
...
...
@@ -421,7 +413,7 @@ const InitDataBase = props => {
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
userName
:
obj
.
userName
,
password
:
Encrypt
(
obj
.
password
)
,
password
:
obj
.
password
,
desc
,
})
.
then
(
res
=>
{
...
...
@@ -467,7 +459,7 @@ const InitDataBase = props => {
const
GetDb
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
GetDbProduct
({
...
obj
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
if
(
res
.
data
.
Product
)
{
...
...
@@ -509,7 +501,7 @@ const InitDataBase = props => {
setInitLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
req1
=
GetProductList
();
let
req2
=
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
});
let
req2
=
GetDbProduct
({
...
obj
});
Promise
.
all
([
req1
,
req2
])
.
then
(
res
=>
{
if
(
res
[
1
].
code
!==
0
||
res
[
0
].
code
!==
0
)
{
...
...
@@ -660,7 +652,7 @@ const InitDataBase = props => {
...
obj
,
productSetting
,
license
:
j
,
password
:
Encrypt
(
obj
.
password
)
,
password
:
obj
.
password
,
}).
then
(
res
=>
{
setInitLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
@@ -801,6 +793,7 @@ const InitDataBase = props => {
form=
{
form
}
onFinish=
{
onFinish
}
onValuesChange=
{
onValuesChange
}
autoComplete=
"off"
>
<
Form
.
Item
label=
{
`${formLables.ip}:`
}
...
...
@@ -832,10 +825,10 @@ const InitDataBase = props => {
},
]
}
>
<
Input
placeholder=
"请输入用户名称"
/>
<
Input
placeholder=
"请输入用户名称"
autoComplete=
"off"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
{
`${formLables.password}:`
}
label=
"数据库用户密码"
name=
"password"
rules=
{
[
{
...
...
@@ -849,10 +842,15 @@ const InitDataBase = props => {
},
]
}
>
<
Input
placeholder=
"请输入用户密码"
type=
"password"
/>
<
Input
placeholder=
"请输入用户密码"
type=
"password"
autoComplete=
"new-password"
id=
"pwd"
/>
</
Form
.
Item
>
<
Form
.
Item
label=
{
`${formLables.dbName}:`
}
label=
"数据库名称"
name=
"dbName"
rules=
{
[
{
...
...
src/pages/database/databaseInitialization/AppendModal.jsx
View file @
01aa4ee9
...
...
@@ -96,7 +96,8 @@ const AppendModal = props => {
const
getProduct
=
()
=>
{
setLoading
(
true
);
GetLicenseDifference
({
...
value
,
password
:
Encrypt
(
value
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
value
.
password
)
===
''
?
Encrypt
(
value
.
password
)
:
value
.
password
;
GetLicenseDifference
({
...
value
,
password
:
pwd
}).
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
code
===
0
)
{
setKeepData
(
res
.
data
);
...
...
src/pages/database/databaseInitialization/DatabaseInitialization.jsx
View file @
01aa4ee9
...
...
@@ -367,7 +367,7 @@ const DatabaseInitialization = props => {
ip
:
resdata
.
data
.
ip
,
dbName
:
resdata
.
data
.
dbName
,
userName
:
resdata
.
data
.
userName
,
password
:
Decrypt
(
resdata
.
data
.
password
)
,
password
:
resdata
.
data
.
password
,
});
GetDbChangeFirst
(
kk
);
// 有License的情况下首次进入展示数据
...
...
@@ -452,7 +452,8 @@ const DatabaseInitialization = props => {
const
GetDbChangeFirst
=
kk
=>
{
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
GetDbProduct
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
IsAuthorize
)
{
...
...
@@ -502,7 +503,8 @@ const DatabaseInitialization = props => {
const
GetDbChange
=
e
=>
{
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
GetDbProduct
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
IsAuthorize
)
{
...
...
@@ -514,7 +516,7 @@ const DatabaseInitialization = props => {
}
}
else
{
let
obj1
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj1
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res1
=>
{
CheckDatabaseIsExist
({
...
obj1
,
password
:
pwd
}).
then
(
res1
=>
{
setCardLoading
(
false
);
if
(
res1
.
code
===
0
)
{
if
(
...
...
@@ -617,7 +619,8 @@ const DatabaseInitialization = props => {
const
GetDbChangeAppend
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
GetDbProduct
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
GetDbProduct
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
if
(
res
.
data
.
Product
.
length
>
0
)
{
...
...
@@ -701,7 +704,8 @@ const DatabaseInitialization = props => {
handleShowModal
(
'initVisible'
,
false
);
setInitVisible
(
true
);
doInitLog
();
NewInitAddDataBase
({
...
obj
,
productSetting
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
NewInitAddDataBase
({
...
obj
,
productSetting
,
password
:
pwd
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
GetDbChangeAppend
();
// 刷星已初始化的产品勾选
setMsg
(
'未检测到可用License'
);
...
...
@@ -756,9 +760,10 @@ const DatabaseInitialization = props => {
setInitVisible
(
true
);
doInitLog
();
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
InitEditDataBase
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
,
password
:
pwd
,
isOldDbToNewDb
:
appendType
===
'yes'
?
true
:
false
,
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
...
...
@@ -852,7 +857,8 @@ const DatabaseInitialization = props => {
// setKeepValue([]);
setProduct
([]);
setCardLoading
(
true
);
GetProductList
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
GetProductList
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
GetDbChange
();
...
...
@@ -884,7 +890,8 @@ const DatabaseInitialization = props => {
// 非授权模式下环境检查
const
checkUnLicense
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
CheckDatabaseIsExist
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
!==
0
)
{
setbeforeColor
(
'red'
);
...
...
@@ -897,7 +904,8 @@ const DatabaseInitialization = props => {
const
onCheckLaster
=
aa
=>
{
// 此时有授权码才能进入
let
obj
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
CheckDatabaseIsExist
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
==
0
)
{
setDataValue
(
form
.
getFieldsValue
());
...
...
@@ -945,7 +953,8 @@ const DatabaseInitialization = props => {
setAppendType
(
'no'
);
let
obj
=
form
.
getFieldsValue
();
if
(
obj
.
ip
&&
obj
.
userName
&&
obj
.
password
&&
obj
.
dbName
)
{
GetProductList
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
GetProductList
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
GetDbChange
(
1
);
...
...
@@ -974,7 +983,8 @@ const DatabaseInitialization = props => {
const
findCheck
=
aa
=>
{
let
obj
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
CheckDatabaseIsExist
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
setDataValue
(
form
.
getFieldsValue
());
...
...
@@ -1029,7 +1039,8 @@ const DatabaseInitialization = props => {
const
findCheck1
=
aa
=>
{
let
obj
=
form
.
getFieldsValue
();
CheckDatabaseIsExist
({
...
obj
,
password
:
Encrypt
(
obj
.
password
)
}).
then
(
res
=>
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
CheckDatabaseIsExist
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
setDataValue
(
form
.
getFieldsValue
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment