Commit b311cc7c authored by John Wang's avatar John Wang

fix: already active when re-invite member

parent 074faa4b
...@@ -98,7 +98,7 @@ class MemberCancelInviteApi(Resource): ...@@ -98,7 +98,7 @@ class MemberCancelInviteApi(Resource):
@login_required @login_required
@account_initialization_required @account_initialization_required
def delete(self, member_id): def delete(self, member_id):
member = Account.query.get(str(member_id)) member = db.session.query(Account).filter(Account.id == member_id).first()
if not member: if not member:
abort(404) abort(404)
......
...@@ -293,8 +293,6 @@ class TenantService: ...@@ -293,8 +293,6 @@ class TenantService:
@staticmethod @staticmethod
def remove_member_from_tenant(tenant: Tenant, account: Account, operator: Account) -> None: def remove_member_from_tenant(tenant: Tenant, account: Account, operator: Account) -> None:
"""Remove member from tenant""" """Remove member from tenant"""
# todo: check permission
if operator.id == account.id and TenantService.check_member_permission(tenant, operator, account, 'remove'): if operator.id == account.id and TenantService.check_member_permission(tenant, operator, account, 'remove'):
raise CannotOperateSelfError("Cannot operate self.") raise CannotOperateSelfError("Cannot operate self.")
...@@ -303,6 +301,12 @@ class TenantService: ...@@ -303,6 +301,12 @@ class TenantService:
raise MemberNotInTenantError("Member not in tenant.") raise MemberNotInTenantError("Member not in tenant.")
db.session.delete(ta) db.session.delete(ta)
account.initialized_at = None
account.status = AccountStatus.PENDING.value
account.password = None
account.password_salt = None
db.session.commit() db.session.commit()
@staticmethod @staticmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment