File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -542,7 +542,15 @@ export async function postTogglePasswordStatus(user, comment) {
542
542
543
543
export async function postResetPassword ( email ) {
544
544
try {
545
- const { data } = await getAuthenticatedHttpClient ( ) . post ( AppUrls . getResetPasswordUrl ( ) , `email_from_support_tools=${ email } ` ) ;
545
+ const { data } = await getAuthenticatedHttpClient ( ) . post (
546
+ AppUrls . getResetPasswordUrl ( ) ,
547
+ { email_from_support_tools : email } ,
548
+ {
549
+ headers : {
550
+ 'Content-Type' : 'application/x-www-form-urlencoded' ,
551
+ } ,
552
+ } ,
553
+ ) ;
546
554
return data ;
547
555
} catch ( error ) {
548
556
return {
Original file line number Diff line number Diff line change @@ -551,10 +551,17 @@ describe('API', () => {
551
551
describe ( 'Reset Password' , ( ) => {
552
552
const resetPasswordApiUrl = `${ getConfig ( ) . LMS_BASE_URL } /account/password` ;
553
553
554
- it ( 'Reset Password Response' , async ( ) => {
554
+ test . each ( [
555
+ 'email@example.com' ,
556
+ 'email.name+test@example.com' ,
557
+ 'email_name-test@example.com' ,
558
+ ] ) ( 'Reset Password Response for %s' , async ( email ) => {
555
559
const expectedResponse = { } ;
556
- mockAdapter . onPost ( resetPasswordApiUrl , `email_from_support_tools=${ testEmail } ` ) . reply ( 200 , expectedResponse ) ;
557
- const response = await api . postResetPassword ( testEmail ) ;
560
+ mockAdapter . onPost (
561
+ resetPasswordApiUrl ,
562
+ `email_from_support_tools=${ encodeURIComponent ( email ) } ` ,
563
+ ) . reply ( 200 , expectedResponse ) ;
564
+ const response = await api . postResetPassword ( email ) ;
558
565
expect ( response ) . toEqual ( expectedResponse ) ;
559
566
} ) ;
560
567
} ) ;
You can’t perform that action at this time.
0 commit comments