Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,33 @@ describe("MemberActionsService", () => {
expect(result).toBe(false);
});

it("should allow reset password when user status is accepted and AdminResetTwoFactor is enabled", () => {
const user = {
...mockOrgUser,
status: OrganizationUserStatusType.Accepted,
} as OrganizationUserView;

const result = service.allowResetPassword(user, mockOrganization, resetPasswordEnabled, true);

expect(result).toBe(true);
});

it("should not allow reset password when user status is accepted and AdminResetTwoFactor is disabled", () => {
const user = {
...mockOrgUser,
status: OrganizationUserStatusType.Accepted,
} as OrganizationUserView;

const result = service.allowResetPassword(
user,
mockOrganization,
resetPasswordEnabled,
false,
);

expect(result).toBe(false);
});

it("should not allow reset password when user status is invited", () => {
const user = {
...mockOrgUser,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ export class MemberActionsService {

const statusAllowed =
orgUser.status === OrganizationUserStatusType.Confirmed ||
(adminResetTwoFactorEnabled && orgUser.status === OrganizationUserStatusType.Revoked);
(adminResetTwoFactorEnabled && orgUser.status === OrganizationUserStatusType.Revoked) ||
(adminResetTwoFactorEnabled && orgUser.status === OrganizationUserStatusType.Accepted);

return (
organization.canManageUsersPassword &&
Expand Down
Loading