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
b8620f9a
Commit
b8620f9a
authored
Jul 11, 2023
by
John Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: CurrentPasswordIncorrectError not return with error msg
parent
dad32ba7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
account.py
api/controllers/console/workspace/account.py
+6
-4
error.py
api/controllers/console/workspace/error.py
+6
-0
account_service.py
api/services/account_service.py
+0
-1
No files found.
api/controllers/console/workspace/account.py
View file @
b8620f9a
...
@@ -9,14 +9,13 @@ from flask_restful import Resource, reqparse, fields, marshal_with
...
@@ -9,14 +9,13 @@ from flask_restful import Resource, reqparse, fields, marshal_with
from
controllers.console
import
api
from
controllers.console
import
api
from
controllers.console.setup
import
setup_required
from
controllers.console.setup
import
setup_required
from
controllers.console.workspace.error
import
AccountAlreadyInitedError
,
InvalidInvitationCodeError
,
\
from
controllers.console.workspace.error
import
AccountAlreadyInitedError
,
InvalidInvitationCodeError
,
\
RepeatPasswordNotMatchError
RepeatPasswordNotMatchError
,
CurrentPasswordIncorrectError
from
controllers.console.wraps
import
account_initialization_required
from
controllers.console.wraps
import
account_initialization_required
from
libs.helper
import
TimestampField
,
supported_language
,
timezone
from
libs.helper
import
TimestampField
,
supported_language
,
timezone
from
extensions.ext_database
import
db
from
extensions.ext_database
import
db
from
models.account
import
InvitationCode
,
AccountIntegrate
from
models.account
import
InvitationCode
,
AccountIntegrate
from
services.account_service
import
AccountService
from
services.account_service
import
AccountService
account_fields
=
{
account_fields
=
{
'id'
:
fields
.
String
,
'id'
:
fields
.
String
,
'name'
:
fields
.
String
,
'name'
:
fields
.
String
,
...
@@ -195,8 +194,11 @@ class AccountPasswordApi(Resource):
...
@@ -195,8 +194,11 @@ class AccountPasswordApi(Resource):
if
args
[
'new_password'
]
!=
args
[
'repeat_new_password'
]:
if
args
[
'new_password'
]
!=
args
[
'repeat_new_password'
]:
raise
RepeatPasswordNotMatchError
()
raise
RepeatPasswordNotMatchError
()
AccountService
.
update_account_password
(
try
:
current_user
,
args
[
'password'
],
args
[
'new_password'
])
AccountService
.
update_account_password
(
current_user
,
args
[
'password'
],
args
[
'new_password'
])
except
api
.
services
.
errors
.
account
.
CurrentPasswordIncorrectError
:
raise
CurrentPasswordIncorrectError
()
return
{
"result"
:
"success"
}
return
{
"result"
:
"success"
}
...
...
api/controllers/console/workspace/error.py
View file @
b8620f9a
...
@@ -7,6 +7,12 @@ class RepeatPasswordNotMatchError(BaseHTTPException):
...
@@ -7,6 +7,12 @@ class RepeatPasswordNotMatchError(BaseHTTPException):
code
=
400
code
=
400
class
CurrentPasswordIncorrectError
(
BaseHTTPException
):
error_code
=
'current_password_incorrect'
description
=
"Current password is incorrect."
code
=
400
class
ProviderRequestFailedError
(
BaseHTTPException
):
class
ProviderRequestFailedError
(
BaseHTTPException
):
error_code
=
'provider_request_failed'
error_code
=
'provider_request_failed'
description
=
None
description
=
None
...
...
api/services/account_service.py
View file @
b8620f9a
...
@@ -52,7 +52,6 @@ class AccountService:
...
@@ -52,7 +52,6 @@ class AccountService:
@
staticmethod
@
staticmethod
def
update_account_password
(
account
,
password
,
new_password
):
def
update_account_password
(
account
,
password
,
new_password
):
"""update account password"""
"""update account password"""
# todo: split validation and update
if
account
.
password
and
not
compare_password
(
password
,
account
.
password
,
account
.
password_salt
):
if
account
.
password
and
not
compare_password
(
password
,
account
.
password
,
account
.
password_salt
):
raise
CurrentPasswordIncorrectError
(
"Current password is incorrect."
)
raise
CurrentPasswordIncorrectError
(
"Current password is incorrect."
)
...
...
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