Skip to content

Commit 308fac1

Browse files
fix(admin-panel): remove sending password reset email from admin panel
Because: * password reset email is deprecated and should no longer be used This commit: * remove the functionality to send password reset emails from admin panel Closes #FXA-10974
1 parent 6804616 commit 308fac1

8 files changed

Lines changed: 0 additions & 65 deletions

File tree

libs/shared/guards/src/lib/admin-panel-guard.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export enum AdminPanelFeature {
4343
DeleteAccount = 'DeleteAccount',
4444
RelyingParties = 'RelyingParties',
4545
RelyingPartiesEditNotes = 'RelyingPartiesEditNotes',
46-
SendPasswordResetEmail = 'SendPasswordResetEmail',
4746
UnsubscribeFromMailingLists = 'UnsubscribeFromMailingLists',
4847
}
4948

@@ -181,10 +180,6 @@ const defaultAdminPanelPermissions: Permissions = {
181180
name: 'Edit Relying Parties Notes',
182181
level: PermissionLevel.Admin,
183182
},
184-
[AdminPanelFeature.SendPasswordResetEmail]: {
185-
name: 'Send Password Reset Email',
186-
level: PermissionLevel.Support,
187-
},
188183
[AdminPanelFeature.UnsubscribeFromMailingLists]: {
189184
name: 'Unsubscribe User From Mozilla Mailing Lists',
190185
level: PermissionLevel.Support,

packages/fxa-admin-panel/src/components/PageAccountSearch/Account/index.test.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,6 @@ it('displays the locale', async () => {
284284
expect(getByTestId('edit-account-locale')).toBeInTheDocument();
285285
});
286286

287-
it('displays send password reset', async () => {
288-
const { getByTestId } = render(
289-
<MockedProvider>
290-
<Account {...accountResponse} />
291-
</MockedProvider>
292-
);
293-
expect(getByTestId('password-reset-button')).toBeInTheDocument();
294-
});
295-
296287
it('displays key-stretch-version', async () => {
297288
const lockedAccount = {
298289
...accountResponse,

packages/fxa-admin-panel/src/components/PageAccountSearch/DangerZone/index.gql.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ export const REMOVE_2FA = gql`
2828
}
2929
`;
3030

31-
export const SEND_PASSWORD_RESET_EMAIL = gql`
32-
mutation sendPasswordResetEmail($email: String!) {
33-
sendPasswordResetEmail(email: $email)
34-
}
35-
`;
36-
3731
export const UNSUBSCRIBE_FROM_MAILING_LISTS = gql`
3832
mutation unsubscribeFromMailingLists($uid: String!) {
3933
unsubscribeFromMailingLists(uid: $uid)

packages/fxa-admin-panel/src/components/PageAccountSearch/DangerZone/index.tsx

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
DISABLE_ACCOUNT,
1414
ENABLE_ACCOUNT,
1515
REMOVE_2FA,
16-
SEND_PASSWORD_RESET_EMAIL,
1716
UNSUBSCRIBE_FROM_MAILING_LISTS,
1817
UNVERIFY_EMAIL,
1918
} from './index.gql';
@@ -143,16 +142,6 @@ export const DangerZone = ({
143142
},
144143
});
145144

146-
const [sendPasswordResetEmail] = useMutation(SEND_PASSWORD_RESET_EMAIL, {
147-
onCompleted: () => {
148-
window.alert(`Password reset email sent to ${email.email}`);
149-
onCleared();
150-
},
151-
onError: () => {
152-
window.alert('Error sending password reset email.');
153-
},
154-
});
155-
156145
const [recordAdminSecurityEvent] = useMutation(RECORD_ADMIN_SECURITY_EVENT);
157146

158147
const handleDisable = () => {
@@ -181,13 +170,6 @@ export const DangerZone = ({
181170
});
182171
};
183172

184-
const handleSendPasswordReset = () => {
185-
if (!window.confirm('Are you sure?')) {
186-
return;
187-
}
188-
sendPasswordResetEmail({ variables: { email: email.email } });
189-
};
190-
191173
// define loading messages
192174
const loadingMessage = 'Please wait a moment...';
193175
let unverifyMessage = '';
@@ -254,17 +236,6 @@ export const DangerZone = ({
254236
/>
255237
</Guard>
256238
)}
257-
<Guard features={[AdminPanelFeature.SendPasswordResetEmail]}>
258-
<DangerZoneAction
259-
header="Send Password Reset Email"
260-
description="Send the user a password reset email to all verified emails. For
261-
Sync users this will also reset their encryption key so make sure
262-
they have a backup of Sync data."
263-
buttonHandler={handleSendPasswordReset}
264-
buttonText="Password Reset"
265-
buttonTestId="password-reset-button"
266-
/>
267-
</Guard>
268239
<Guard features={[AdminPanelFeature.UnsubscribeFromMailingLists]}>
269240
<DangerZoneAction
270241
header="Unsubscribe From Mailing Lists"

packages/fxa-admin-server/src/gql/account/account.resolver.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -508,13 +508,6 @@ describe('#integration - AccountResolver', () => {
508508
});
509509
});
510510

511-
it('sends password reset email', async () => {
512-
authClient.passwordForgotSendCode = jest.fn().mockResolvedValue(true);
513-
const result = await resolver.sendPasswordResetEmail(USER_1.email);
514-
expect(authClient.passwordForgotSendCode).toBeCalledTimes(1);
515-
expect(result).toBe(true);
516-
});
517-
518511
describe('unsubscribes from mailing lists', () => {
519512
const fakeToken = '123';
520513
const uid = USER_1.uid;

packages/fxa-admin-server/src/gql/account/account.resolver.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,6 @@ export class AccountResolver {
348348
return !!result;
349349
}
350350

351-
@Features(AdminPanelFeature.SendPasswordResetEmail)
352-
@Mutation((returns) => Boolean)
353-
public async sendPasswordResetEmail(@Args('email') email: string) {
354-
const result = await this.authAPI.passwordForgotSendCode(email);
355-
return !!result;
356-
}
357-
358351
@Features(AdminPanelFeature.AccountSearch)
359352
@Mutation((returns) => Boolean)
360353
public async recordAdminSecurityEvent(

packages/fxa-admin-server/src/graphql.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ export interface IMutation {
240240
disableAccount(uid: string): boolean | Promise<boolean>;
241241
editLocale(uid: string, locale: string): boolean | Promise<boolean>;
242242
enableAccount(uid: string): boolean | Promise<boolean>;
243-
sendPasswordResetEmail(email: string): boolean | Promise<boolean>;
244243
recordAdminSecurityEvent(uid: string, name: string): boolean | Promise<boolean>;
245244
unlinkAccount(uid: string): boolean | Promise<boolean>;
246245
unsubscribeFromMailingLists(uid: string): boolean | Promise<boolean>;

packages/fxa-admin-server/src/schema.gql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ type Mutation {
236236
disableAccount(uid: String!): Boolean!
237237
editLocale(uid: String!, locale: String!): Boolean!
238238
enableAccount(uid: String!): Boolean!
239-
sendPasswordResetEmail(email: String!): Boolean!
240239
recordAdminSecurityEvent(uid: String!, name: String!): Boolean!
241240
unlinkAccount(uid: String!): Boolean!
242241
unsubscribeFromMailingLists(uid: String!): Boolean!

0 commit comments

Comments
 (0)