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
76996219
Unverified
Commit
76996219
authored
Nov 06, 2023
by
YiLi
Committed by
GitHub
Nov 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Use correct typehint for return values (#1454)
Co-authored-by: lethe <lethe>
parent
4dfbcd0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
account_service.py
api/services/account_service.py
+5
-4
No files found.
api/services/account_service.py
View file @
76996219
...
...
@@ -6,7 +6,7 @@ import secrets
import
uuid
from
datetime
import
datetime
,
timedelta
from
hashlib
import
sha256
from
typing
import
Optional
from
typing
import
Optional
,
Dict
,
Any
from
werkzeug.exceptions
import
Forbidden
,
Unauthorized
from
flask
import
session
,
current_app
...
...
@@ -24,7 +24,8 @@ from libs.passport import PassportService
from
models.account
import
*
from
tasks.mail_invite_member_task
import
send_invite_member_mail_task
def
_create_tenant_for_account
(
account
):
def
_create_tenant_for_account
(
account
)
->
Tenant
:
tenant
=
TenantService
.
create_tenant
(
f
"{account.name}'s Workspace"
)
TenantService
.
create_tenant_member
(
tenant
,
account
,
role
=
'owner'
)
...
...
@@ -505,7 +506,7 @@ class RegisterService:
redis_client
.
delete
(
cls
.
_get_invitation_token_key
(
token
))
@
classmethod
def
get_invitation_if_token_valid
(
cls
,
workspace_id
:
str
,
email
:
str
,
token
:
str
)
->
Optional
[
Account
]:
def
get_invitation_if_token_valid
(
cls
,
workspace_id
:
str
,
email
:
str
,
token
:
str
)
->
Optional
[
Dict
[
str
,
Any
]
]:
invitation_data
=
cls
.
_get_invitation_by_token
(
token
,
workspace_id
,
email
)
if
not
invitation_data
:
return
None
...
...
@@ -539,7 +540,7 @@ class RegisterService:
}
@
classmethod
def
_get_invitation_by_token
(
cls
,
token
:
str
,
workspace_id
:
str
,
email
:
str
)
->
Optional
[
str
]:
def
_get_invitation_by_token
(
cls
,
token
:
str
,
workspace_id
:
str
,
email
:
str
)
->
Optional
[
Dict
[
str
,
str
]
]:
if
workspace_id
is
not
None
and
email
is
not
None
:
email_hash
=
sha256
(
email
.
encode
())
.
hexdigest
()
cache_key
=
f
'member_invite_token:{workspace_id}, {email_hash}:{token}'
...
...
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