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
dad32ba7
Commit
dad32ba7
authored
Jul 11, 2023
by
John Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: password hash error
parent
005e866a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
account_service.py
api/services/account_service.py
+8
-1
No files found.
api/services/account_service.py
View file @
dad32ba7
...
...
@@ -55,9 +55,16 @@ class AccountService:
# todo: split validation and update
if
account
.
password
and
not
compare_password
(
password
,
account
.
password
,
account
.
password_salt
):
raise
CurrentPasswordIncorrectError
(
"Current password is incorrect."
)
password_hashed
=
hash_password
(
new_password
,
account
.
password_salt
)
# generate password salt
salt
=
secrets
.
token_bytes
(
16
)
base64_salt
=
base64
.
b64encode
(
salt
)
.
decode
()
# encrypt password with salt
password_hashed
=
hash_password
(
new_password
,
salt
)
base64_password_hashed
=
base64
.
b64encode
(
password_hashed
)
.
decode
()
account
.
password
=
base64_password_hashed
account
.
password_salt
=
base64_salt
db
.
session
.
commit
()
return
account
...
...
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