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
8c30004c
Commit
8c30004c
authored
Jun 21, 2023
by
Jason
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.fix 權限登入問題
2.修改密碼邏輯
parent
8f51b435
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
194 additions
and
160 deletions
+194
-160
KeyController.cs
...n Vault Management/backstage/Controllers/KeyController.cs
+7
-4
TokenVaultController .cs
...Management/backstage/Controllers/TokenVaultController .cs
+11
-11
UserController.cs
... Vault Management/backstage/Controllers/UserController.cs
+84
-69
User.cs
...ant Token Vault Management/backstage/Models/Users/User.cs
+1
-0
ListKeys.cshtml
...oken Vault Management/backstage/Views/Key/ListKeys.cshtml
+4
-1
_Layout.cshtml
...en Vault Management/backstage/Views/Shared/_Layout.cshtml
+2
-2
ListUsers.cshtml
...lt Management/backstage/Views/TokenVault/ListUsers.cshtml
+85
-73
key_part1.png
...n Vault Management/backstage/wwwroot/images/key_part1.png
+0
-0
key_part2.png
...n Vault Management/backstage/wwwroot/images/key_part2.png
+0
-0
No files found.
Merchant Token Vault Management/backstage/Controllers/KeyController.cs
View file @
8c30004c
...
@@ -173,12 +173,15 @@ namespace backstage.Controllers
...
@@ -173,12 +173,15 @@ namespace backstage.Controllers
{
{
// 下載圖檔位元組數據
// 下載圖檔位元組數據
byte
[]
imageBytes
=
await
client
.
GetByteArrayAsync
(
imageUrl
);
byte
[]
imageBytes
=
await
client
.
GetByteArrayAsync
(
imageUrl
);
System
.
IO
.
File
.
Delete
(
imagePath
);
// 將圖檔寫入目標路徑
// 將圖檔寫入目標路徑
System
.
IO
.
File
.
WriteAllBytes
(
imagePath
,
imageBytes
);
System
.
IO
.
File
.
WriteAllBytes
(
imagePath
,
imageBytes
);
// 添加下載路徑到集合中
// 添加下載路徑到集合中
string
downloadPath
=
Path
.
Combine
(
"/images"
,
fileName
);
if
(
System
.
IO
.
File
.
Exists
(
imagePath
))
downloadPaths
.
Add
(
downloadPath
);
{
string
downloadPath
=
Path
.
Combine
(
"/images"
,
fileName
);
downloadPaths
.
Add
(
downloadPath
);
}
}
}
}
}
...
@@ -216,7 +219,7 @@ namespace backstage.Controllers
...
@@ -216,7 +219,7 @@ namespace backstage.Controllers
}
}
result
.
IsSuccess
=
true
;
result
.
IsSuccess
=
true
;
result
.
Message
=
msg
;
result
.
Message
=
msg
;
return
result
;
return
result
;
}
}
else
else
...
...
Merchant Token Vault Management/backstage/Controllers/TokenVaultController .cs
View file @
8c30004c
...
@@ -628,20 +628,20 @@ namespace backstage.Controllers
...
@@ -628,20 +628,20 @@ namespace backstage.Controllers
/// <returns></returns>
/// <returns></returns>
[
Authorize
(
Policy
=
"AdminOnly"
)]
[
Authorize
(
Policy
=
"AdminOnly"
)]
[
HttpPost
]
[
HttpPost
]
public
async
Task
<
ResultModel
>
AddUsers
([
FromBody
]
JsonElement
requestData
)
public
async
Task
<
ResultModel
>
AddUsers
([
FromBody
]
IFormCollection
form
)
{
{
string
msg
;
string
msg
;
var
result
=
new
ResultModel
();
var
result
=
new
ResultModel
();
int
Merchant_id
=
requestData
.
GetProperty
(
"Merchant_id"
).
GetInt32
(
);
int
merchant_id
=
Convert
.
ToInt32
(
form
[
"merchant_id"
]
);
int
vault_id
=
requestData
.
GetProperty
(
"vault_id"
).
GetInt32
(
);
int
vault_id
=
Convert
.
ToInt32
(
form
[
"vault_id"
]
);
int
field_id
=
requestData
.
GetProperty
(
"field_id"
).
GetInt32
(
);
int
field_id
=
Convert
.
ToInt32
(
form
[
"field_id"
]
);
int
user_id
=
requestData
.
GetProperty
(
"user_id"
).
GetInt32
(
);
int
user_id
=
Convert
.
ToInt32
(
form
[
"id"
]
);
// 構建包含參數的查詢字串
// 構建包含參數的查詢字串
var
queryString
=
new
RouteValueDictionary
{
var
queryString
=
new
RouteValueDictionary
{
{
"Merchant_id"
,
M
erchant_id
},
{
"Merchant_id"
,
m
erchant_id
},
{
"vault_id"
,
vault_id
},
{
"vault_id"
,
vault_id
},
{
"field_id"
,
field_id
},
{
"field_id"
,
field_id
},
};
};
...
@@ -749,7 +749,7 @@ namespace backstage.Controllers
...
@@ -749,7 +749,7 @@ namespace backstage.Controllers
var
DepartmentsResponse
=
JsonConvert
.
DeserializeObject
<
DepartmentsResponse
>(
apiResult
.
Data
.
ToString
());
var
DepartmentsResponse
=
JsonConvert
.
DeserializeObject
<
DepartmentsResponse
>(
apiResult
.
Data
.
ToString
());
if
(
DepartmentsResponse
.
count
>
0
)
if
(
DepartmentsResponse
.
count
>
0
)
{
{
var
existDepartment
=
DepartmentsResponse
.
merchants
.
Where
(
m
=>
m
.
merchant_id
==
M
erchant_id
).
FirstOrDefault
();
var
existDepartment
=
DepartmentsResponse
.
merchants
.
Where
(
m
=>
m
.
merchant_id
==
m
erchant_id
).
FirstOrDefault
();
if
(
existDepartment
==
null
)
if
(
existDepartment
==
null
)
{
{
switch
(
_currentLanguage
)
switch
(
_currentLanguage
)
...
@@ -820,7 +820,7 @@ namespace backstage.Controllers
...
@@ -820,7 +820,7 @@ namespace backstage.Controllers
httpMethod
=
HttpMethod
.
Post
;
httpMethod
=
HttpMethod
.
Post
;
parameters
=
new
Dictionary
<
string
,
string
>
parameters
=
new
Dictionary
<
string
,
string
>
{
{
{
"Merchant_id"
,
M
erchant_id
.
ToString
()
},
{
"Merchant_id"
,
m
erchant_id
.
ToString
()
},
{
"id"
,
vault_id
.
ToString
()
},
{
"id"
,
vault_id
.
ToString
()
},
{
"info"
,
"FIELDS"
},
{
"info"
,
"FIELDS"
},
...
@@ -904,7 +904,7 @@ namespace backstage.Controllers
...
@@ -904,7 +904,7 @@ namespace backstage.Controllers
{
{
new
{
new
{
userId
=
user_id
.
ToString
(),
userId
=
user_id
.
ToString
(),
merchantId
=
M
erchant_id
.
ToString
()
merchantId
=
m
erchant_id
.
ToString
()
}
}
};
};
parameters
=
new
Dictionary
<
string
,
string
>
parameters
=
new
Dictionary
<
string
,
string
>
...
@@ -949,7 +949,7 @@ namespace backstage.Controllers
...
@@ -949,7 +949,7 @@ namespace backstage.Controllers
{
"token"
,
token
},
{
"token"
,
token
},
{
"vault_id"
,
vault_id
.
ToString
()},
{
"vault_id"
,
vault_id
.
ToString
()},
{
"access_code"
,
"31"
},
{
"access_code"
,
"31"
},
{
"merchant_id"
,
M
erchant_id
.
ToString
()},
{
"merchant_id"
,
m
erchant_id
.
ToString
()},
{
"user_id"
,
user_id
.
ToString
()},
{
"user_id"
,
user_id
.
ToString
()},
};
};
...
@@ -999,7 +999,7 @@ namespace backstage.Controllers
...
@@ -999,7 +999,7 @@ namespace backstage.Controllers
{
"id"
,
vault_id
.
ToString
()},
{
"id"
,
vault_id
.
ToString
()},
{
"info"
,
"USERS"
},
{
"info"
,
"USERS"
},
{
"Merchant_id"
,
M
erchant_id
.
ToString
()},
{
"Merchant_id"
,
m
erchant_id
.
ToString
()},
{
"data"
,
JsonConvert
.
SerializeObject
(
addUserToField_data
)},
{
"data"
,
JsonConvert
.
SerializeObject
(
addUserToField_data
)},
};
};
...
...
Merchant Token Vault Management/backstage/Controllers/UserController.cs
View file @
8c30004c
This diff is collapsed.
Click to expand it.
Merchant Token Vault Management/backstage/Models/Users/User.cs
View file @
8c30004c
...
@@ -34,6 +34,7 @@ namespace backstage.Models.Users
...
@@ -34,6 +34,7 @@ namespace backstage.Models.Users
public
string
lang
{
get
;
set
;
}
=
"zhg"
;
public
string
lang
{
get
;
set
;
}
=
"zhg"
;
//判斷是否為admin
//判斷是否為admin
public
bool
isAdmin
{
get
;
set
;
}
=
false
;
public
bool
isAdmin
{
get
;
set
;
}
=
false
;
public
int
[]
admin_rold_id
{
get
;
set
;
}
=
new
int
[
1
];
//最高權限
//=========Fields=========
//=========Fields=========
public
List
<
int
>
masks
{
get
;
set
;}
public
List
<
int
>
masks
{
get
;
set
;}
...
...
Merchant Token Vault Management/backstage/Views/Key/ListKeys.cshtml
View file @
8c30004c
...
@@ -399,6 +399,8 @@
...
@@ -399,6 +399,8 @@
document.getElementById("recoverKeyForm").classList.remove("show");
document.getElementById("recoverKeyForm").classList.remove("show");
// 页面加载完成后,隐藏 maskSettingsAdvID
// 页面加载完成后,隐藏 maskSettingsAdvID
//刪除鑰匙
//刪除鑰匙
$("#confirmBtn").on("click", function (e) {
$("#confirmBtn").on("click", function (e) {
...
@@ -455,7 +457,8 @@
...
@@ -455,7 +457,8 @@
$('#image2').attr('src', imageUrls[1]);
$('#image2').attr('src', imageUrls[1]);
$('#downloadBtn1').attr('href', imageUrls[0]);
$('#downloadBtn1').attr('href', imageUrls[0]);
$('#downloadBtn2').attr('href', imageUrls[1]);
$('#downloadBtn2').attr('href', imageUrls[1]);
$('#imageModal').modal();
$('#imageModal').modal({ backdrop: 'static', keyboard: false });
//setTimeout(function () {
//setTimeout(function () {
// location.reload();
// location.reload();
//}, 2000);
//}, 2000);
...
...
Merchant Token Vault Management/backstage/Views/Shared/_Layout.cshtml
View file @
8c30004c
...
@@ -79,12 +79,12 @@
...
@@ -79,12 +79,12 @@
<a
class=
"dropdown-item"
asp-controller=
"User"
asp-action=
"ChangePassword"
asp-route-username=
"@Context.User.Claims.FirstOrDefault(m => m.Type == "
username
").
Value
"
asp-route-returnUrl=
"@Context.Request.Path.Value"
>
<a
class=
"dropdown-item"
asp-controller=
"User"
asp-action=
"ChangePassword"
asp-route-username=
"@Context.User.Claims.FirstOrDefault(m => m.Type == "
username
").
Value
"
asp-route-returnUrl=
"@Context.Request.Path.Value"
>
<i
class=
"mdi mdi-lock-open mr-2"
></i>
@Localizer["Change Password"]
<i
class=
"mdi mdi-lock-open mr-2"
></i>
@Localizer["Change Password"]
</a>
</a>
<a
class=
"dropdown-item"
asp-controller=
"User"
asp-action=
"Register"
>
@*
<a
class=
"dropdown-item"
asp-controller=
"User"
asp-action=
"Register"
>
<i
class=
"mdi mdi-account-plus mr-2"
></i>
@Localizer["Setting Backup"]
<i
class=
"mdi mdi-account-plus mr-2"
></i>
@Localizer["Setting Backup"]
</a>
</a>
<a
class=
"dropdown-item"
asp-controller=
""
asp-action=
""
>
<a
class=
"dropdown-item"
asp-controller=
""
asp-action=
""
>
<i
class=
"mdi mdi-account-details mr-2"
></i>
@Localizer["Vault Backup"]
<i
class=
"mdi mdi-account-details mr-2"
></i>
@Localizer["Vault Backup"]
</a>
</a>
*@
<div
class=
"dropdown-divider"
></div>
<div
class=
"dropdown-divider"
></div>
<a
class=
"dropdown-item"
asp-controller=
"User"
asp-action=
"Logout"
>
<a
class=
"dropdown-item"
asp-controller=
"User"
asp-action=
"Logout"
>
...
...
Merchant Token Vault Management/backstage/Views/TokenVault/ListUsers.cshtml
View file @
8c30004c
This diff is collapsed.
Click to expand it.
Merchant Token Vault Management/backstage/wwwroot/images/key_part1.png
View replaced file @
8f51b435
View file @
8c30004c
721 Bytes
|
W:
|
H:
716 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
Merchant Token Vault Management/backstage/wwwroot/images/key_part2.png
View replaced file @
8f51b435
View file @
8c30004c
709 Bytes
|
W:
|
H:
709 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
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