Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
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
ai-tech
dify
Commits
c1e7193c
Unverified
Commit
c1e7193c
authored
Nov 06, 2023
by
Garfield Dai
Committed by
GitHub
Nov 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: hidden api key enhancement. (#1468)
parent
2423563d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
api_based_extension_fields.py
api/fields/api_based_extension_fields.py
+7
-1
No files found.
api/fields/api_based_extension_fields.py
View file @
c1e7193c
...
...
@@ -5,7 +5,13 @@ from libs.helper import TimestampField
class
HiddenAPIKey
(
fields
.
Raw
):
def
output
(
self
,
key
,
obj
):
return
obj
.
api_key
[:
3
]
+
'***'
+
obj
.
api_key
[
-
3
:]
api_key
=
obj
.
api_key
# If the length of the api_key is less than 8 characters, show the first and last characters
if
len
(
api_key
)
<=
8
:
return
api_key
[
0
]
+
'******'
+
api_key
[
-
1
]
# If the api_key is greater than 8 characters, show the first three and the last three characters
else
:
return
api_key
[:
3
]
+
'******'
+
api_key
[
-
3
:]
api_based_extension_fields
=
{
...
...
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