Api invitation link (#110)
* feat(api): invitation token to add team members * feat(api): invitation link change password feat(db): changed base_auth structure * feat(api): invitation link - regenerate/reset feat(api): invitation link - restore deleted user * feat(api): invitation link for forget password feat(api): changed email body for invite user and reset password * feat(api): invitation link, expired invitation and has joined in the list of members * feat(api): invitation link for EE * feat(api): return invitation link with the list of members
This commit is contained in:
parent
1c5f13a152
commit
46091c687d
2 changed files with 19 additions and 4 deletions
|
|
@ -367,14 +367,21 @@ def get_members(tenant_id):
|
|||
(CASE WHEN users.role = 'member' THEN TRUE ELSE FALSE END) AS member,
|
||||
DATE_PART('day',timezone('utc'::text, now()) \
|
||||
- COALESCE(basic_authentication.invited_at,'2000-01-01'::timestamp ))>=1 AS expired_invitation,
|
||||
basic_authentication.password IS NOT NULL AS joined
|
||||
basic_authentication.password IS NOT NULL AS joined,
|
||||
invitation_token
|
||||
FROM public.users LEFT JOIN public.basic_authentication ON users.user_id=basic_authentication.user_id
|
||||
WHERE users.deleted_at IS NULL
|
||||
ORDER BY name, id"""
|
||||
)
|
||||
r = cur.fetchall()
|
||||
if len(r):
|
||||
return helper.list_to_camel_case(r)
|
||||
r = helper.list_to_camel_case(r)
|
||||
for u in r:
|
||||
if u["invitationToken"]:
|
||||
u["invitationLink"] = __get_invitation_link(u.pop("invitationToken"))
|
||||
else:
|
||||
u["invitationLink"] = None
|
||||
return r
|
||||
|
||||
return []
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ def generate_new_invitation(user_id):
|
|||
)
|
||||
return __get_invitation_link(cur.fetchone().pop("invitation_token"))
|
||||
|
||||
|
||||
|
||||
def reset_member(tenant_id, editor_id, user_id_to_update):
|
||||
admin = get(tenant_id=tenant_id, user_id=editor_id)
|
||||
|
|
@ -373,7 +374,8 @@ def get_members(tenant_id):
|
|||
(CASE WHEN users.role = 'member' THEN TRUE ELSE FALSE END) AS member,
|
||||
DATE_PART('day',timezone('utc'::text, now()) \
|
||||
- COALESCE(basic_authentication.invited_at,'2000-01-01'::timestamp ))>=1 AS expired_invitation,
|
||||
basic_authentication.password IS NOT NULL AS joined
|
||||
basic_authentication.password IS NOT NULL AS joined,
|
||||
invitation_token
|
||||
FROM public.users LEFT JOIN public.basic_authentication ON users.user_id=basic_authentication.user_id
|
||||
WHERE users.tenant_id = %(tenantId)s AND users.deleted_at IS NULL
|
||||
ORDER BY name, id""",
|
||||
|
|
@ -381,7 +383,13 @@ def get_members(tenant_id):
|
|||
)
|
||||
r = cur.fetchall()
|
||||
if len(r):
|
||||
return helper.list_to_camel_case(r)
|
||||
r = helper.list_to_camel_case(r)
|
||||
for u in r:
|
||||
if u["invitationToken"]:
|
||||
u["invitationLink"] = __get_invitation_link(u.pop("invitationToken"))
|
||||
else:
|
||||
u["invitationLink"] = None
|
||||
return r
|
||||
|
||||
return []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue