PerformAccountDeactivation deactivates the user's account, removing all ability for the user to login again.
(ctx context.Context, req *api.PerformAccountDeactivationRequest, res *api.PerformAccountDeactivationResponse)
| 491 | |
| 492 | // PerformAccountDeactivation deactivates the user's account, removing all ability for the user to login again. |
| 493 | func (a *UserInternalAPI) PerformAccountDeactivation(ctx context.Context, req *api.PerformAccountDeactivationRequest, res *api.PerformAccountDeactivationResponse) error { |
| 494 | evacuateReq := &rsapi.PerformAdminEvacuateUserRequest{ |
| 495 | UserID: fmt.Sprintf("@%s:%s", req.Localpart, a.ServerName), |
| 496 | } |
| 497 | evacuateRes := &rsapi.PerformAdminEvacuateUserResponse{} |
| 498 | a.RSAPI.PerformAdminEvacuateUser(ctx, evacuateReq, evacuateRes) |
| 499 | if err := evacuateRes.Error; err != nil { |
| 500 | logrus.WithError(err).Errorf("Failed to evacuate user after account deactivation") |
| 501 | } |
| 502 | |
| 503 | deviceReq := &api.PerformDeviceDeletionRequest{ |
| 504 | UserID: fmt.Sprintf("@%s:%s", req.Localpart, a.ServerName), |
| 505 | } |
| 506 | deviceRes := &api.PerformDeviceDeletionResponse{} |
| 507 | if err := a.PerformDeviceDeletion(ctx, deviceReq, deviceRes); err != nil { |
| 508 | return err |
| 509 | } |
| 510 | |
| 511 | pusherReq := &api.PerformPusherDeletionRequest{ |
| 512 | Localpart: req.Localpart, |
| 513 | } |
| 514 | if err := a.PerformPusherDeletion(ctx, pusherReq, &struct{}{}); err != nil { |
| 515 | return err |
| 516 | } |
| 517 | |
| 518 | err := a.DB.DeactivateAccount(ctx, req.Localpart) |
| 519 | res.AccountDeactivated = err == nil |
| 520 | return err |
| 521 | } |
| 522 | |
| 523 | // PerformOpenIDTokenCreation creates a new token that a relying party uses to authenticate a user |
| 524 | func (a *UserInternalAPI) PerformOpenIDTokenCreation(ctx context.Context, req *api.PerformOpenIDTokenCreationRequest, res *api.PerformOpenIDTokenCreationResponse) error { |
nothing calls this directly
no test coverage detected