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
77bb5e0c
Commit
77bb5e0c
authored
Apr 18, 2024
by
皮倩雯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: '解密bug修复'
parent
5192971b
Pipeline
#87437
passed with stages
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
134 additions
and
97 deletions
+134
-97
InitDataBase.jsx
src/pages/database/InitDataBase/InitDataBase.jsx
+19
-13
AddModal.jsx
src/pages/database/databaseConfig/dm/AddModal.jsx
+13
-8
AddModal.jsx
src/pages/database/databaseConfig/mysqltable/AddModal.jsx
+12
-8
AddModal.jsx
src/pages/database/databaseConfig/oracle/AddModal.jsx
+12
-8
AddModal.jsx
src/pages/database/databaseConfig/redis/AddModal.jsx
+13
-8
AddModal.jsx
src/pages/database/databaseConfig/sqlServer/AddModal.jsx
+13
-8
AppendModal.jsx
src/pages/database/databaseInitialization/AppendModal.jsx
+8
-4
DatabaseInitialization.jsx
...atabase/databaseInitialization/DatabaseInitialization.jsx
+44
-40
No files found.
src/pages/database/InitDataBase/InitDataBase.jsx
View file @
77bb5e0c
...
...
@@ -116,7 +116,7 @@ const InitDataBase = props => {
padding
:
CryptoJS
.
pad
.
Pkcs7
,
});
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
);
return
decryptedStr
.
toString
();
return
decryptedStr
?
.
toString
();
};
//加密
...
...
@@ -167,10 +167,10 @@ const InitDataBase = props => {
const
onFinish
=
values
=>
{
setCardLoading
(
true
);
const
obj
=
values
;
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
saveConnectionNew
({
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
...
...
@@ -213,14 +213,15 @@ const InitDataBase = props => {
});
});
};
// 测试连接
const
onCheck
=
e
=>
{
setCardLoading
(
true
);
const
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
connectionTest
({
ip
:
obj
.
ip
,
dbName
:
obj
.
dbName
,
...
...
@@ -249,13 +250,18 @@ const InitDataBase = props => {
console
.
log
(
err
);
});
};
const
isAlphanumeric
=
str
=>
{
return
/^
[
A-Za-z0-9
]
+$/
.
test
(
str
);
};
// 获取数据库列表
const
selectFocus
=
e
=>
{
let
params
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
params
.
password
)
===
''
||
Decrypt
(
params
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
params
.
password
)
:
params
.
password
;
let
pwd
=
params
.
password
;
if
(
params
.
password
.
length
<
32
||
!
isAlphanumeric
(
params
.
password
))
{
pwd
=
Encrypt
(
params
.
password
);
}
getDataBaseList
({
userName
:
params
.
userName
||
''
,
password
:
pwd
||
''
,
...
...
src/pages/database/databaseConfig/dm/AddModal.jsx
View file @
77bb5e0c
...
...
@@ -36,16 +36,21 @@ const AddModal = props => {
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
isAlphanumeric
=
str
=>
{
return
/^
[
A-Za-z0-9
]
+$/
.
test
(
str
);
};
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
if
(
type
===
'add'
)
{
AddConnString
({
...
obj
,
...
...
@@ -82,10 +87,10 @@ const AddModal = props => {
};
const
handleEdit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
EditConnString
({
...
obj
,
oldName
:
formObj
.
name
,
...
...
src/pages/database/databaseConfig/mysqltable/AddModal.jsx
View file @
77bb5e0c
...
...
@@ -36,16 +36,20 @@ const AddModal = props => {
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
isAlphanumeric
=
str
=>
{
return
/^
[
A-Za-z0-9
]
+$/
.
test
(
str
);
};
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
if
(
type
===
'add'
)
{
AddConnString
({
type
:
'mysql'
,
...
...
@@ -82,10 +86,10 @@ const AddModal = props => {
};
const
handleEdit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
EditConnString
({
type
:
'mysql'
,
...
obj
,
...
...
src/pages/database/databaseConfig/oracle/AddModal.jsx
View file @
77bb5e0c
...
...
@@ -36,16 +36,20 @@ const AddModal = props => {
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
isAlphanumeric
=
str
=>
{
return
/^
[
A-Za-z0-9
]
+$/
.
test
(
str
);
};
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
if
(
type
===
'add'
)
{
AddConnString
({
...
obj
,
...
...
@@ -82,10 +86,10 @@ const AddModal = props => {
};
const
handleEdit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
EditConnString
({
type
:
'oracle'
,
...
obj
,
...
...
src/pages/database/databaseConfig/redis/AddModal.jsx
View file @
77bb5e0c
...
...
@@ -36,16 +36,17 @@ const AddModal = props => {
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
if
(
type
===
'add'
)
{
AddConnString
({
...
obj
,
...
...
@@ -80,12 +81,16 @@ const AddModal = props => {
}
});
};
const
isAlphanumeric
=
str
=>
{
return
/^
[
A-Za-z0-9
]
+$/
.
test
(
str
);
};
const
handleEdit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
EditConnString
({
...
obj
,
oldName
:
formObj
.
name
,
...
...
src/pages/database/databaseConfig/sqlServer/AddModal.jsx
View file @
77bb5e0c
...
...
@@ -36,16 +36,21 @@ const AddModal = props => {
});
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
isAlphanumeric
=
str
=>
{
return
/^
[
A-Za-z0-9
]
+$/
.
test
(
str
);
};
// 提交
const
onSubmit
=
()
=>
{
form
.
validateFields
().
then
(
validate
=>
{
if
(
validate
)
{
setLoading
(
true
);
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
if
(
type
===
'add'
)
{
AddConnString
({
...
obj
,
...
...
@@ -82,10 +87,10 @@ const AddModal = props => {
};
const
handleEdit
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
EditConnString
({
...
obj
,
oldName
:
formObj
.
name
,
...
...
src/pages/database/databaseInitialization/AppendModal.jsx
View file @
77bb5e0c
...
...
@@ -94,12 +94,16 @@ const AppendModal = props => {
return
encrypted
.
ciphertext
.
toString
().
toUpperCase
();
};
const
isAlphanumeric
=
str
=>
{
return
/^
[
A-Za-z0-9
]
+$/
.
test
(
str
);
};
const
getProduct
=
()
=>
{
setLoading
(
true
);
let
pwd
=
Decrypt
(
value
.
password
)
===
''
||
Decrypt
(
value
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
value
.
password
)
:
value
.
password
;
let
pwd
=
value
.
password
;
if
(
value
.
password
.
length
<
32
||
!
isAlphanumeric
(
value
.
password
))
{
pwd
=
Encrypt
(
value
.
password
);
}
GetLicenseDifference
({
...
value
,
password
:
pwd
}).
then
(
res
=>
{
setLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
src/pages/database/databaseInitialization/DatabaseInitialization.jsx
View file @
77bb5e0c
...
...
@@ -439,12 +439,16 @@ const DatabaseInitialization = props => {
});
};
const
isAlphanumeric
=
str
=>
{
return
/^
[
A-Za-z0-9
]
+$/
.
test
(
str
);
};
const
GetDbChangeFirst
=
kk
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
GetDbProduct
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
@@ -495,10 +499,10 @@ const DatabaseInitialization = props => {
const
GetDbChange
=
e
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
GetDbProduct
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
@@ -614,10 +618,10 @@ const DatabaseInitialization = props => {
const
GetDbChangeAppend
=
()
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
GetDbProduct
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
@@ -702,10 +706,10 @@ const DatabaseInitialization = props => {
handleShowModal
(
'initVisible'
,
false
);
setInitVisible
(
true
);
doInitLog
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
NewInitAddDataBase
({
...
obj
,
productSetting
,
password
:
pwd
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
GetDbChangeAppend
();
// 刷星已初始化的产品勾选
...
...
@@ -764,10 +768,10 @@ const DatabaseInitialization = props => {
setInitVisible
(
true
);
doInitLog
();
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
InitEditDataBase
({
...
obj
,
password
:
pwd
,
...
...
@@ -833,10 +837,10 @@ const DatabaseInitialization = props => {
// setKeepValue([]);
setProduct
([]);
setCardLoading
(
true
);
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
GetProductList
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
if
(
res
.
code
===
0
)
{
console
.
log
(
res
.
data
);
...
...
@@ -870,10 +874,10 @@ const DatabaseInitialization = props => {
const
onCheckLaster
=
aa
=>
{
// 此时有授权码才能进入
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
CheckDatabaseIsExist
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
==
0
)
{
...
...
@@ -918,10 +922,10 @@ const DatabaseInitialization = props => {
setAppendType
(
'no'
);
let
obj
=
form
.
getFieldsValue
();
if
(
obj
.
ip
&&
obj
.
userName
&&
obj
.
password
&&
obj
.
dbName
&&
obj
.
providerType
)
{
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
GetProductList
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
@@ -951,10 +955,10 @@ const DatabaseInitialization = props => {
const
findCheck
=
aa
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
CheckDatabaseIsExist
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
@@ -1004,10 +1008,10 @@ const DatabaseInitialization = props => {
const
findCheck1
=
aa
=>
{
let
obj
=
form
.
getFieldsValue
();
let
pwd
=
Decrypt
(
obj
.
password
)
===
''
||
Decrypt
(
obj
.
password
).
indexOf
(
'
\
u0004'
)
!==
-
1
?
Encrypt
(
obj
.
password
)
:
obj
.
password
;
let
pwd
=
obj
.
password
;
if
(
obj
.
password
.
length
<
32
||
!
isAlphanumeric
(
obj
.
password
))
{
pwd
=
Encrypt
(
obj
.
password
);
}
CheckDatabaseIsExist
({
...
obj
,
password
:
pwd
}).
then
(
res
=>
{
setCardLoading
(
false
);
if
(
res
.
code
===
0
)
{
...
...
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