Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
T
TokenVaultManagement
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jasonwai
TokenVaultManagement
Commits
af852a90
Commit
af852a90
authored
Jun 17, 2023
by
DESKTOP-KIP9E0Q\jason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.刪除mask
2.編輯mask, 修正js 3.user list 當switch完成在顯示table 4.移除欄位使用者
parent
4eecaac7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
343 additions
and
359 deletions
+343
-359
TokenVaultController .cs
...Management/backstage/Controllers/TokenVaultController .cs
+136
-270
ListMasks.zh.resx
...nt/backstage/Resources/Views/TokenVault/ListMasks.zh.resx
+27
-0
ListFields.cshtml
...t Management/backstage/Views/TokenVault/ListFields.cshtml
+3
-3
ListMasks.cshtml
...lt Management/backstage/Views/TokenVault/ListMasks.cshtml
+63
-72
ListUsers.cshtml
...lt Management/backstage/Views/TokenVault/ListUsers.cshtml
+91
-1
ListUsers.cshtml
...en Vault Management/backstage/Views/User/ListUsers.cshtml
+11
-1
style.css
...nt Token Vault Management/backstage/wwwroot/css/style.css
+2
-2
tokenizationPlatform.js
...t Management/backstage/wwwroot/js/tokenizationPlatform.js
+10
-10
No files found.
Merchant Token Vault Management/backstage/Controllers/TokenVaultController .cs
View file @
af852a90
...
...
@@ -179,7 +179,7 @@ namespace backstage.Controllers
ViewBag
.
vault_id
=
vault_id
;
ViewBag
.
field_id
=
field_id
;
var
url
=
_config
[
"IP"
]
+
"/v2/vault/get"
;
var
httpMethod
=
HttpMethod
.
Post
;
// 取得使用者的 "token" Claim 值
...
...
@@ -774,298 +774,60 @@ namespace backstage.Controllers
string
token
=
User
.
FindFirstValue
(
"token"
);
//檢查user_id是否存在
var
url
=
_config
[
"IP"
]
+
"/
user/lis
t"
;
var
url
=
_config
[
"IP"
]
+
"/
v2/vaul
t"
;
var
httpMethod
=
HttpMethod
.
Post
;
var
types
=
new
[]
{
"all"
};
var
types_data
=
new
{
inc
=
types
};
var
data
=
new
[]{
new
{
action
=
"DEL"
,
id
=
user_id
,
field_id
}
};
var
parameters
=
new
Dictionary
<
string
,
string
>
{
{
"
token"
,
token
},
{
"
types"
,
JsonConvert
.
SerializeObject
(
types_
data
)},
{
"
email"
,
"1
"
},
{
"
phone"
,
"1"
}
{
"
id"
,
vault_id
.
ToString
()
},
{
"
data"
,
JsonConvert
.
SerializeObject
(
data
)},
{
"
info"
,
"USERS
"
},
{
"
Merchant_id"
,
Merchant_id
.
ToString
()
}
};
var
apiResult
=
await
_callApi
.
CallAPI
(
url
,
parameters
,
httpMethod
);
if
(
apiResult
.
IsSuccess
)
{
var
UserResponse
=
JsonConvert
.
DeserializeObject
<
UserResponse
>(
apiResult
.
Data
.
ToString
());
if
(
UserResponse
.
userCount
>
0
)
{
var
existUser
=
UserResponse
.
Users
.
Where
(
u
=>
u
.
uid
==
user_id
).
FirstOrDefault
();
if
(
existUser
==
null
)
{
switch
(
_currentLanguage
)
{
case
"en"
:
msg
=
"User_id is not exist."
;
break
;
case
"zh"
:
msg
=
"user_id不存在"
;
break
;
default
:
msg
=
"user_id不存在"
;
break
;
}
result
.
IsSuccess
=
false
;
result
.
Message
=
msg
;
return
result
;
}
}
else
var
Response
=
JsonConvert
.
DeserializeObject
<
Response
>(
apiResult
.
Data
.
ToString
());
if
(
Response
.
r
==
0
)
{
switch
(
_currentLanguage
)
{
case
"en"
:
msg
=
"
User_id is not exist
."
;
msg
=
"
Remove user success
."
;
break
;
case
"zh"
:
msg
=
"
user_id不存在
"
;
msg
=
"
移除使用者成功
"
;
break
;
default
:
msg
=
"
user_id不存在
"
;
msg
=
"
移除使用者成功
"
;
break
;
}
result
.
IsSuccess
=
fals
e
;
result
.
IsSuccess
=
tru
e
;
result
.
Message
=
msg
;
return
result
;
}
}
else
{
switch
(
_currentLanguage
)
{
case
"en"
:
msg
=
"Check field_id failed."
;
break
;
case
"zh"
:
msg
=
"檢查field_id失敗"
;
break
;
default
:
msg
=
"檢查field_id失敗"
;
break
;
}
result
.
IsSuccess
=
false
;
result
.
Message
=
msg
;
return
result
;
}
//檢查merchant_id是否存在
url
=
_config
[
"IP"
]
+
"/merchant/list"
;
httpMethod
=
HttpMethod
.
Post
;
parameters
=
new
Dictionary
<
string
,
string
>
{
{
"token"
,
token
},
};
apiResult
=
await
_callApi
.
CallAPI
(
url
,
parameters
,
httpMethod
);
if
(
apiResult
.
IsSuccess
)
{
var
DepartmentsResponse
=
JsonConvert
.
DeserializeObject
<
DepartmentsResponse
>(
apiResult
.
Data
.
ToString
());
if
(
DepartmentsResponse
.
count
>
0
)
{
var
existDepartment
=
DepartmentsResponse
.
merchants
.
Where
(
m
=>
m
.
merchant_id
==
Merchant_id
).
FirstOrDefault
();
if
(
existDepartment
==
null
)
{
switch
(
_currentLanguage
)
{
case
"en"
:
msg
=
"Merchant_id is not exist."
;
break
;
case
"zh"
:
msg
=
"merchant_id不存在"
;
break
;
default
:
msg
=
"merchant_id不存在"
;
break
;
}
result
.
IsSuccess
=
false
;
result
.
Message
=
msg
;
return
result
;
}
}
else
{
result
.
IsSuccess
=
false
;
result
.
Message
=
"merchant_id不存在"
;
return
result
;
}
}
else
{
switch
(
_currentLanguage
)
{
case
"en"
:
msg
=
"User_id is not exist."
;
break
;
case
"zh"
:
msg
=
"檢查merchant_id失敗"
;
break
;
default
:
msg
=
"檢查merchant_id失敗"
;
break
;
}
result
.
IsSuccess
=
false
;
result
.
Message
=
msg
;
return
result
;
}
//檢查field_id是否存在
url
=
_config
[
"IP"
]
+
"/v2/vault/get"
;
httpMethod
=
HttpMethod
.
Post
;
parameters
=
new
Dictionary
<
string
,
string
>
{
{
"Merchant_id"
,
Merchant_id
.
ToString
()
},
{
"id"
,
vault_id
.
ToString
()
},
{
"info"
,
"FIELDS"
},
};
apiResult
=
await
_callApi
.
CallAPI
(
url
,
parameters
,
httpMethod
);
if
(
apiResult
.
IsSuccess
)
{
var
FieldsResponse
=
JsonConvert
.
DeserializeObject
<
FieldsResponse
>(
apiResult
.
Data
.
ToString
());
if
(
FieldsResponse
.
fields
.
Count
>
0
)
{
var
existField
=
FieldsResponse
.
fields
.
Where
(
m
=>
m
.
id
==
field_id
).
FirstOrDefault
();
if
(
existField
==
null
)
{
result
.
IsSuccess
=
false
;
result
.
Message
=
"field_id不存在"
;
}
}
else
{
result
.
IsSuccess
=
false
;
result
.
Message
=
"field_id不存在"
;
}
}
else
{
result
.
IsSuccess
=
false
;
result
.
Message
=
"檢查field_id失敗"
;
return
result
;
}
//加入部門
url
=
_config
[
"IP"
]
+
"/merchant/adduser"
;
httpMethod
=
HttpMethod
.
Post
;
var
data
=
new
[]
{
new
{
userId
=
user_id
.
ToString
(),
merchantId
=
Merchant_id
.
ToString
()
}
};
parameters
=
new
Dictionary
<
string
,
string
>
{
{
"token"
,
token
},
{
"data"
,
JsonConvert
.
SerializeObject
(
data
)}
//{ "data", """userId"":""1"",""merchantId"":""1""")
};
apiResult
=
await
_callApi
.
CallAPI
(
url
,
parameters
,
httpMethod
);
if
(!
apiResult
.
IsSuccess
)
{
var
departmentResponse
=
JsonConvert
.
DeserializeObject
<
DepartmentsResponse
>(
apiResult
.
Data
.
ToString
());
if
(
departmentResponse
.
r
!=
0
)
{
result
.
IsSuccess
=
false
;
result
.
Message
=
"加入部門失敗"
+
apiResult
.
Data
.
ToString
();
return
result
;
}
}
//加入vault
var
TokenVaultResponse
=
new
TokenVaultResponse
();
url
=
_config
[
"IP"
]
+
"/merchant/vault/access"
;
httpMethod
=
HttpMethod
.
Post
;
parameters
=
new
Dictionary
<
string
,
string
>
{
{
"token"
,
token
},
{
"vault_id"
,
vault_id
.
ToString
()},
{
"access_code"
,
"31"
},
{
"merchant_id"
,
Merchant_id
.
ToString
()},
{
"user_id"
,
user_id
.
ToString
()},
};
apiResult
=
await
_callApi
.
CallAPI
(
url
,
parameters
,
httpMethod
);
if
(!
apiResult
.
IsSuccess
)
{
result
.
IsSuccess
=
false
;
result
.
Message
=
"加入vault失敗"
;
return
result
;
}
//加入欄位
var
FieldsResponse2
=
new
FieldsResponse
();
url
=
_config
[
"IP"
]
+
"/v2/vault"
;
httpMethod
=
HttpMethod
.
Post
;
var
addUserToField_data
=
new
[]
{
new
{
action
=
"ADD"
,
id
=
user_id
,
field_id
=
field_id
,
allow_decrypt
=
"1"
,
allow_new
=
"1"
,
allow_update
=
"1"
,
allow_del
=
"1"
,
default_mask_id
=
"1"
}
};
parameters
=
new
Dictionary
<
string
,
string
>
{
{
"id"
,
vault_id
.
ToString
()},
{
"info"
,
"USERS"
},
{
"Merchant_id"
,
Merchant_id
.
ToString
()},
{
"data"
,
JsonConvert
.
SerializeObject
(
addUserToField_data
)},
};
apiResult
=
await
_callApi
.
CallAPI
(
url
,
parameters
,
httpMethod
);
if
(
apiResult
.
IsSuccess
)
{
FieldsResponse2
=
JsonConvert
.
DeserializeObject
<
FieldsResponse
>(
apiResult
.
Data
.
ToString
());
if
(
FieldsResponse2
.
failInfo
!=
null
)
{
result
.
IsSuccess
=
false
;
result
.
Message
=
"加入Fields失敗"
+
FieldsResponse2
.
m
;
result
.
Message
=
Response
.
m
.
ToString
()
;
return
result
;
}
else
{
result
.
IsSuccess
=
true
;
result
.
Message
=
"加入Fields成功"
;
return
result
;
}
}
else
{
result
.
IsSuccess
=
false
;
result
.
Message
=
"加入Fields失敗"
+
apiResult
.
Data
.
ToString
()
;
result
.
Message
=
apiResult
.
Message
;
return
result
;
}
...
...
@@ -1273,14 +1035,15 @@ namespace backstage.Controllers
}
}
//新增MASK ajax
//新增
or編輯
MASK ajax
[
Authorize
(
Policy
=
"AdminOnly"
)]
[
HttpPost
]
public
async
Task
<
ResultModel
>
CreateMask
(
IFormCollection
form
)
{
var
result
=
new
ResultModel
();
string
msg
;
//判斷非null就是編輯 反之新增
var
mask_id
=
(
form
.
ContainsKey
(
"mask_id"
)
&&
Convert
.
ToInt32
(
form
[
"mask_id"
])
!=
0
)
?
Convert
.
ToInt32
(
form
[
"mask_id"
])
:
(
int
?)
null
;
try
{
...
...
@@ -1288,9 +1051,22 @@ namespace backstage.Controllers
if
(
string
.
IsNullOrEmpty
(
form
[
"name"
]))
{
switch
(
_currentLanguage
)
{
case
"en"
:
msg
=
"Name is empty."
;
break
;
case
"zh"
:
msg
=
"名稱不能為空"
;
break
;
default
:
msg
=
"名稱不能為空"
;
break
;
}
result
.
IsSuccess
=
false
;
result
.
Message
=
"名稱不能為空"
;
result
.
Message
=
msg
;
return
result
;
}
...
...
@@ -1306,18 +1082,28 @@ namespace backstage.Controllers
size_end
=
GetValidIntegerValue
(
form
[
"size_end"
]),
};
string
action
=
"ADD"
;
if
(
mask_id
!=
null
)
{
action
=
"MOD"
;
}
var
fieldData
=
new
[]
{
new
{
action
=
"ADD"
,
action
=
action
,
field_id
=
Convert
.
ToInt32
(
form
[
"field_id"
]),
name
=
form
[
"name"
].
ToString
(),
type
=
Convert
.
ToInt32
(
form
[
"type"
]),
setting
=
System
.
Text
.
Json
.
JsonSerializer
.
Serialize
(
setting
)
setting
=
System
.
Text
.
Json
.
JsonSerializer
.
Serialize
(
setting
),
//編輯功能 mask_id要帶上
id
=
(
form
.
ContainsKey
(
"mask_id"
)
&&
Convert
.
ToInt32
(
form
[
"mask_id"
])
!=
0
)
?
Convert
.
ToInt32
(
form
[
"mask_id"
])
:
(
int
?)
null
}
};
}
};
string
namstext
=
form
[
"name"
];
var
parameters
=
new
Dictionary
<
string
,
string
>
...
...
@@ -1336,8 +1122,22 @@ namespace backstage.Controllers
{
if
(
Response
.
failInfo
==
null
)
{
switch
(
_currentLanguage
)
{
case
"en"
:
msg
=
"Create mask success."
;
break
;
case
"zh"
:
msg
=
"新增遮罩成功"
;
break
;
default
:
msg
=
"新增遮罩成功"
;
break
;
}
result
.
IsSuccess
=
true
;
result
.
Message
=
"Create success"
;
result
.
Message
=
msg
;
return
result
;
}
...
...
@@ -1381,6 +1181,72 @@ namespace backstage.Controllers
public
async
Task
<
ResultModel
>
DeleteMask
(
int
merchant_id
,
int
vault_id
,
int
mask_id
)
{
var
result
=
new
ResultModel
();
string
msg
;
#
region
key
/
list
var
url
=
_config
[
"IP"
]
+
"/v2/vault"
;
var
httpMethod
=
HttpMethod
.
Post
;
var
data
=
new
[]{
new
{
action
=
"DEL"
,
id
=
mask_id
}
};
var
parameters
=
new
Dictionary
<
string
,
string
>
{
{
"id"
,
vault_id
.
ToString
()},
{
"Merchant_id"
,
merchant_id
.
ToString
()},
{
"info"
,
"MASKS"
},
{
"data"
,
JsonConvert
.
SerializeObject
(
data
)}
};
var
apiResult
=
await
_callApi
.
CallAPI
(
url
,
parameters
,
httpMethod
);
if
(
apiResult
.
IsSuccess
)
{
try
{
var
Response
=
JsonConvert
.
DeserializeObject
<
Response
>(
apiResult
.
Data
.
ToString
());
if
(
Response
.
failInfo
==
null
)
{
switch
(
_currentLanguage
)
{
case
"en"
:
msg
=
"Delete mask success."
;
break
;
case
"zh"
:
msg
=
"遮罩刪除成功"
;
break
;
default
:
msg
=
"遮罩刪除成功"
;
break
;
}
result
.
IsSuccess
=
true
;
result
.
Message
=
msg
;
return
result
;
}
else
{
result
.
IsSuccess
=
false
;
result
.
Message
=
System
.
Text
.
RegularExpressions
.
Regex
.
Unescape
(
string
.
Join
(
", "
,
Response
.
failInfo
));
return
result
;
}
}
catch
(
Exception
e
)
{
result
.
IsSuccess
=
false
;
result
.
Message
=
e
.
Message
+
e
.
InnerException
?.
Message
;
return
result
;
}
}
result
.
IsSuccess
=
false
;
result
.
Message
=
apiResult
.
Message
;
return
result
;
#
endregion
...
...
@@ -1606,7 +1472,7 @@ namespace backstage.Controllers
msg
=
"啟用"
;
break
;
}
enabletext
=
msg
;
enabletext
=
msg
;
}
string
htmlCode
=
@
$"<tr class=""expense-color"">
...
...
@@ -1804,7 +1670,7 @@ namespace backstage.Controllers
msg
=
"不能為空"
;
break
;
}
ModelState
.
AddModelError
(
"name"
,
msg
);
ModelState
.
AddModelError
(
"name"
,
msg
);
}
if
(
tokenVault
.
merchant_id
==
0
)
{
...
...
Merchant Token Vault Management/backstage/Resources/Views/TokenVault/ListMasks.zh.resx
View file @
af852a90
...
...
@@ -135,6 +135,9 @@
<data
name=
"Allow update"
xml:space=
"preserve"
>
<value>
允許更新
</value>
</data>
<data
name=
"Are you sure you want to delete the mask?"
xml:space=
"preserve"
>
<value>
是否確定要刪除遮罩?
</value>
</data>
<data
name=
"Choose department"
xml:space=
"preserve"
>
<value>
選擇部門
</value>
</data>
...
...
@@ -153,6 +156,9 @@
<data
name=
"Data Mask"
xml:space=
"preserve"
>
<value>
遮罩
</value>
</data>
<data
name=
"Data mask list"
xml:space=
"preserve"
>
<value>
資料遮罩列表
</value>
</data>
<data
name=
"Data Token Vault"
xml:space=
"preserve"
>
<value>
資料代碼保險庫
</value>
</data>
...
...
@@ -162,6 +168,9 @@
<data
name=
"Delete"
xml:space=
"preserve"
>
<value>
刪除
</value>
</data>
<data
name=
"Delete mask"
xml:space=
"preserve"
>
<value>
刪除遮罩
</value>
</data>
<data
name=
"Description"
xml:space=
"preserve"
>
<value>
描述
</value>
</data>
...
...
@@ -189,12 +198,21 @@
<data
name=
"Name"
xml:space=
"preserve"
>
<value>
名稱
</value>
</data>
<data
name=
"No"
xml:space=
"preserve"
>
<value>
否
</value>
</data>
<data
name=
"Number of codes"
xml:space=
"preserve"
>
<value>
代碼數量
</value>
</data>
<data
name=
"Number of users"
xml:space=
"preserve"
>
<value>
使用者數量
</value>
</data>
<data
name=
"Please choose a mask (single choice)"
xml:space=
"preserve"
>
<value>
請選擇遮罩(單選)
</value>
</data>
<data
name=
"Please select the mask type (single choice)"
xml:space=
"preserve"
>
<value>
請選擇遮罩種類(單選)
</value>
</data>
<data
name=
"Remove User"
xml:space=
"preserve"
>
<value>
移除使用者
</value>
</data>
...
...
@@ -204,6 +222,9 @@
<data
name=
"Select user"
xml:space=
"preserve"
>
<value>
新增用戶
</value>
</data>
<data
name=
"Send out"
xml:space=
"preserve"
>
<value>
送出
</value>
</data>
<data
name=
"Serial number"
xml:space=
"preserve"
>
<value>
編號
</value>
</data>
...
...
@@ -219,6 +240,9 @@
<data
name=
"Tpye"
xml:space=
"preserve"
>
<value>
種類
</value>
</data>
<data
name=
"Type"
xml:space=
"preserve"
>
<value>
種類
</value>
</data>
<data
name=
"Username"
xml:space=
"preserve"
>
<value>
用戶名
</value>
</data>
...
...
@@ -228,4 +252,7 @@
<data
name=
"Vault"
xml:space=
"preserve"
>
<value>
保險庫
</value>
</data>
<data
name=
"Yes"
xml:space=
"preserve"
>
<value>
是
</value>
</data>
</root>
\ No newline at end of file
Merchant Token Vault Management/backstage/Views/TokenVault/ListFields.cshtml
View file @
af852a90
...
...
@@ -91,9 +91,9 @@
<div>
<div class="rank-table">
<div class="table-responsive">
<table class="table table-striped
expense-color
">
<table class="table table-striped ">
<thead>
<tr class="
expense-color
">
<tr class="">
<th>@Localizer["Serial number"]</th>
<th>@Localizer["Name"]</th>
<th>@Localizer["Description"]</th>
...
...
@@ -108,7 +108,7 @@
{
@foreach (var i in Model.fields)
{
<tr id="@i.id" class="
expense-color
">
<tr id="@i.id" class="">
<td>@i.id</td>
<td>@i.name</td>
<td>@i.desc</td>
...
...
Merchant Token Vault Management/backstage/Views/TokenVault/ListMasks.cshtml
View file @
af852a90
...
...
@@ -3,15 +3,23 @@
@inject IViewLocalizer Localizer
@model List<backstage.Models.TokenVault.Mask>
@{
ViewData["Title"] =
"Mask列表管理"
;
ViewData["Title"] =
@Localizer["Token Vault List"]
;
}
@{
bool isAdmin = User.IsInRole("Admin");
string disabledClass = isAdmin ? "" : "disabled";
}
@section header
{
<style>
.hidden {
display: none;
}
</style>
}
<div class="page-header">
<h3 class="page-title">
Mask列表管理
</h3>
<h3 class="page-title">
@Localizer["Mask list management"]
</h3>
<input id="msg" hidden value="@TempData["msg"]" />
@if (TempData["isSuccess"] != null)
{
...
...
@@ -70,7 +78,7 @@
<table class="table table-striped table-hover0 table-bordered" id="memberGoTbl_masksList">
<thead>
<tr>
<th colspan="9">@Localizer["
Name"]資料遮罩列表
</th>
<th colspan="9">@Localizer["
Data mask list"]
</th>
</tr>
</thead>
<tbody>
...
...
@@ -96,7 +104,8 @@
<td class="mask_name">@m.name</td>
<td class="content">@m.type</td>
<td class="content">@m.mask</td>
<td class="item">@(m.is_unique==1?"是":"否")</td>
<td class="item">@Localizer[(m.is_unique == 1 ? "Yes" : "No")]</td>
<td class="content">@m.setting</td>
<td>
<a class="editMaskBtn" data-toggle="modal" data-target="#edit-field-mask" title="修改">
...
...
@@ -138,8 +147,8 @@
<!--
<button type="button" class="close" data-dismiss="modal">×</button>
-->
<h3 class="modal-title"
>
新增遮罩
<h3 class="modal-title">
@Localizer["Add mask"]
</h3>
</div> <!--END of div "modal-header"-->
...
...
@@ -155,32 +164,16 @@
</div>
<div class="form-group">
<label class="control-labe required" for="name">
名稱
:</label>
<label class="control-labe required" for="name">
@Localizer["Name"]
:</label>
<div class="">
<input type="text" name="name" class="form-control form-control-sm0" required>
</div>
</div>
<div class="form-group">
<label class="control-labe" for="">是否為唯一值:</label>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="is_unique" id="uniqueY" value="1" checked>
<label class="form-check-label" for="uniqueY">
是
</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="is_unique" id="uniqueN" value="0">
<label class="form-check-label" for="uniqueN">
否
</label>
</div>
</div>
<div class="form-group">
<label class="control-labe" for="userName">種類:</label>
<label class="control-labe" for="userName"> @Localizer["Type"]:</label>
<div class="form-group">
<select title="
請選遮罩種類(單選)
" name="type" id="maskType" class="selectpicker selecter form-control selectpicker-tokenization" onchange="showMaskSettingsAdv()">
<select title="
@Localizer["Please select the mask type (single choice)"]
" name="type" id="maskType" class="selectpicker selecter form-control selectpicker-tokenization" onchange="showMaskSettingsAdv()">
<option class="bs-title-option" value=""></option>
<option value="0">0</option>
<option value="1">1</option>
...
...
@@ -188,46 +181,46 @@
</div>
</div>
<div class="maskSettings" id="maskSettingsAdvID">
<div class="maskSettings
hidden
" id="maskSettingsAdvID">
<hr>
<div class="maskSettingsTitle">
設定:
</div>
<div class="maskSettingsTitle">
@Localizer["Set up"]
</div>
<div class="maskSettingForm">
<div class="form-group">
<label class="control-labe"
for="userName"
>mask:</label>
<label class="control-labe">mask:</label>
<div class="form-group">
<select id="mask" title="
請選擇mask(單選)
" name="mask" class="selectpicker selecter form-control selectpicker-tokenization">
<select id="mask" title="
@Localizer["Please choose a mask (single choice)"]
" name="mask" class="selectpicker selecter form-control selectpicker-tokenization">
<option class="bs-title-option" value=""></option>
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option
value="0"
>0</option>
<option
value="1"
>1</option>
<option
value="2"
>2</option>
<option
value="3"
>3</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-labe required" for="userName">size init:</label>
<div class="">
<input type="number" name="size_init" class="form-control form-control-sm0" required>
<input type="number" name="size_init"
id="size_init"
class="form-control form-control-sm0" required>
</div>
</div>
<div class="form-group">
<label class="control-labe required"
for="userName"
>size end:</label>
<label class="control-labe required">size end:</label>
<div class="">
<input type="number" name="size_end" class="form-control form-control-sm0" required>
<input type="number" name="size_end"
id="size_end"
class="form-control form-control-sm0" required>
</div>
</div>
<div class="form-group">
<label class="control-labe required"
for="userName"
>to skip:</label>
<label class="control-labe required">to skip:</label>
<div class="">
<input type="text" name="toskip" class="form-control form-control-sm0" required>
<input type="text" name="toskip"
id="toskip"
class="form-control form-control-sm0" required>
</div>
</div>
</div>
</div>
<div class="SubmitBlock">
<button id="createMaskBtn" type="button" class="btn btn-mainblue-solid btnSubmit">
送出
</button>
<button type="button" class="btn btn-mainblue-hollow btnReset" data-dismiss="modal">
取消
</button>
<button id="createMaskBtn" type="button" class="btn btn-mainblue-solid btnSubmit">
@Localizer["Send out"]
</button>
<button type="button" class="btn btn-mainblue-hollow btnReset" data-dismiss="modal">
@Localizer["Cancel"]
</button>
</div>
</form>
</div> <!--END of div "modal-body"-->
...
...
@@ -254,7 +247,7 @@
<div class="modal-header">
<h4>
刪除遮罩
@Localizer["Delete mask"]
</h4>
</div> <!--END of div "modal-header"-->
...
...
@@ -262,12 +255,12 @@
<form>
<p>
是否確定要刪除遮罩?
@Localizer["Are you sure you want to delete the mask?"]
</p>
<div class="SubmitBlock SubmitBlock_sm">
<button type="button" id="delMaskConfirmBtn" class="btn btn-mainblue-solid" style="margin-right: 10px; width: 80px">
確定
</button>
<button type="button" class="btn btn-mainblue-hollow" data-dismiss="modal" style="margin-right: 10px; width: 80px">
取消
</button>
<button type="button" id="delMaskConfirmBtn" class="btn btn-mainblue-solid" style="margin-right: 10px; width: 80px">
@Localizer["Confirm"]
</button>
<button type="button" class="btn btn-mainblue-hollow" data-dismiss="modal" style="margin-right: 10px; width: 80px">
@Localizer["Cancel"]
</button>
</div>
</form>
...
...
@@ -297,19 +290,24 @@
showAlert(IsSuccess, msg);
}
// 页面加载完成后,隐藏 maskSettingsAdvID
document.getElementById("maskSettingsAdvID").classList.remove("show");
//新增mask
$("#NewMaskBtn").click(function (event) {
console.log('NewMaskBtn')
$('#new-field-mask .modal-title').text('新增遮罩');
$('#new-field-mask input:not([name="mask_id"], [name="merchant_id"], [name="field_id"], [name="vault_id"])').val('');
$("#maskType").selectpicker("val", "");
$("#mask").selectpicker("val", "");
document.getElementById("maskSettingsAdvID").classList.remove("show");
})
//送出新mask
$("#createMaskBtn").click(function (event) {
$.ajax({
url: '/TokenVault/CreateMask',
type: 'POST',
...
...
@@ -356,35 +354,28 @@
var type = $("#memberGoTbl_masksList tr").filter(function () {
return $(this).find("td:first-child").text().trim() === selectMaskId;
}).find("td:nth-child(3)").text();
console.log("type=" + type);
$("#new-field-mask select[name='type'] option").filter(function () {
return $(this).val() === type;
}).prop("selected", true);
$('#new-field-mask').modal();
//$.ajax({
// url: '/TokenVault/EditMask',
// type: 'POST',
// data: $('#createMaskForm').serialize(),
// success: function (data) {
// //console.log(data);
// showAlert(data.isSuccess, data.message);
// if (data.isSuccess) {
// $('#new-field-mask').modal('hide');
// setTimeout(function () {
// location.reload();
// }, 2000);
// }
// },
// error: function (xhr, status, error) {
// console.log(xhr.responseText);
// showAlert(false, "發生錯誤");
// }
//});
$("#maskType").selectpicker();
$("#maskType").selectpicker("val", type);
})
showMaskSettingsAdv();
var tdData = $("#memberGoTbl_masksList tr").filter(function () {
return $(this).find("td:first-child").text().trim() === selectMaskId;
}).find("td:nth-child(6)").text();
var tdObject = JSON.parse(tdData);
console.log(tdObject);
$("#size_init").val(tdObject.size_init);
$("#size_end").val(tdObject.size_end);
$("#toSkip").val(""); // 这里的值可以根据需要进行设定
$('#new-field-mask').modal();
})
//刪除mask
var selectMaskId = 0;
$('.delMaskBtn').click(function () {
...
...
Merchant Token Vault Management/backstage/Views/TokenVault/ListUsers.cshtml
View file @
af852a90
...
...
@@ -93,7 +93,7 @@
<td>@i.default_mask_id</td>
<td>
<a
class="btn btnPermission btn-sm
">@Localizer["Remove User"]</a>
<a
data-id="@i.id" class="btn btnPermission btn-sm" data-toggle="modal" data-target="#delete-field-user
">@Localizer["Remove User"]</a>
</td>
</tr>
}
...
...
@@ -136,6 +136,48 @@
</div>
</div>
</div>
<!--移除user Form-->
<!-- Modal -->
<div class="modal fade " id="delete-field-user" tabindex="-1" style=" padding-right: 17px;" aria-modal="true" role="dialog">
<div class="modal-dialog modal-sm modalforMemberGo">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4>
@Localizer["Remove user"]
</h4>
</div> <!--END of div "modal-header"-->
<div class="modal-body" style="padding-top:35px; padding-bottom: 35px">
<form>
<p>
@Localizer["Are you sure you want to remove this user?"]
</p>
<div class="SubmitBlock SubmitBlock_sm">
<button type="button" id="delUserConfirmBtn" class="btn btn-mainblue-solid" style="margin-right: 10px; width: 80px"> @Localizer["Confirm"]</button>
<button type="button" class="btn btn-mainblue-hollow" data-dismiss="modal" style="margin-right: 10px; width: 80px"> @Localizer["Cancel"]</button>
</div>
</form>
</div> <!--END of div "modal-body"-->
<div class="modal-footer">
<!--
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
-->
</div> <!--END of div "modal-footer"-->
</div><!-- END of Modal content-->
</div><!-- END of div "modal-dialog modal-lg" -->
</div>
@section Scripts{
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
...
...
@@ -187,6 +229,54 @@
//移除user
var selectUserId = 0;
$('.btnPermission').click(function () {
selectUserId = $(this).data('id');
console.log('selectUserId=' + selectUserId);
})
$('#delUserConfirmBtn').click(function () {
var data = {
Merchant_id: parseInt('@ViewBag.merchant_id'),
vault_id: parseInt('@ViewBag.vault_id'),
field_id: parseInt('@ViewBag.field_id'),
user_id: selectUserId
};
$.ajax({
url: '/TokenVault/DelUsers',
type: 'POST',
data: JSON.stringify(data),
contentType: "application/json",
success: function (data) {
//console.log(data);
showAlert(data.isSuccess, data.message);
if (data.isSuccess) {
$('#delete-field-user').modal('hide');
setTimeout(function () {
location.reload();
}, 2000);
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
showAlert(false, "發生錯誤");
}
});
})
})
...
...
Merchant Token Vault Management/backstage/Views/User/ListUsers.cshtml
View file @
af852a90
...
...
@@ -24,7 +24,7 @@
@*列表*@
<div class="">
<table class="table table-striped">
<table class="table table-striped"
style="display: none;"
>
<thead>
<tr>
<th>uid</th>
...
...
@@ -127,6 +127,11 @@
onColor: 'success',
offColor: 'danger',
size: 'small',
onInit: function () {
// 初始化完成時的操作
// 例如顯示表格等
$('table').show();
},
onSwitchChange: function (event, state) {
var uid = $(this).data('uid');
var isAdmin = $(this).is(':checked')?1:0;
...
...
@@ -155,6 +160,11 @@
onColor: 'success',
offColor: 'danger',
size: 'small',
onInit: function () {
// 初始化完成時的操作
// 例如顯示表格等
$('table').show();
},
onSwitchChange: function (event, state) {
var uid = $(this).data('uid');
var enabled = $(this).is(':checked') ? 1 : 0;;
...
...
Merchant Token Vault Management/backstage/wwwroot/css/style.css
View file @
af852a90
...
...
@@ -19339,6 +19339,6 @@ tbody {
.custom-tooltip
{
cursor
:
pointer
!important
;
}
.deleteKeyBtn
,
.reviseKeyBtn
{
.deleteKeyBtn
,
.reviseKeyBtn
,
.fa-pen-to-square
,
.fa-trash-can
{
cursor
:
pointer
;
}
\ No newline at end of file
}
Merchant Token Vault Management/backstage/wwwroot/js/tokenizationPlatform.js
View file @
af852a90
...
...
@@ -139,23 +139,23 @@ function showBankTypeAdv(){
}
}
function
showMaskSettingsAdv
(){
function
showMaskSettingsAdv
()
{
var
oSel
=
document
.
getElementById
(
"maskType"
);
console
.
log
(
'testtttttt'
)
var
oValue
=
oSel
.
options
[
oSel
.
selectedIndex
].
value
;
if
(
oValue
==
0
){
document
.
getElementById
(
"maskSettingsAdvID"
).
classList
.
toggle
(
"show"
);
}
else
{
document
.
getElementById
(
"maskSettingsAdvID"
)
.
classList
.
remove
(
"show"
);
var
maskSettingsAdvID
=
document
.
getElementById
(
"maskSettingsAdvID"
);
if
(
oValue
==
0
&&
!
maskSettingsAdvID
.
classList
.
contains
(
"show"
))
{
maskSettingsAdvID
.
classList
.
add
(
"show"
);
}
else
if
(
oValue
!=
0
&&
maskSettingsAdvID
.
classList
.
contains
(
"show"
))
{
maskSettingsAdvID
.
classList
.
remove
(
"show"
);
}
}
///////copy to clipboard/////
// function myFunction() {
...
...
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