forked from parse-community/parse-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Parse Server option
resetPasswordSuccessOnInvalidEmail
to…
… choose success or error response on password reset with invalid email (parse-community#7551)
- Loading branch information
Showing
6 changed files
with
73 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1082,4 +1082,43 @@ describe('Custom Pages, Email Verification, Password Reset', () => { | |
done(); | ||
}); | ||
}); | ||
|
||
it('should throw on an invalid reset password', async () => { | ||
await reconfigureServer({ | ||
appName: 'coolapp', | ||
publicServerURL: 'http://localhost:1337/1', | ||
emailAdapter: MockEmailAdapterWithOptions({ | ||
fromAddress: '[email protected]', | ||
apiKey: 'k', | ||
domain: 'd', | ||
}), | ||
passwordPolicy: { | ||
resetPasswordSuccessOnInvalidEmail: false, | ||
}, | ||
}); | ||
|
||
await expectAsync(Parse.User.requestPasswordReset('[email protected]')).toBeRejectedWith( | ||
new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'A user with that email does not exist.') | ||
); | ||
}); | ||
|
||
it('validate resetPasswordSuccessonInvalidEmail', async () => { | ||
const invalidValues = [[], {}, 1, 'string']; | ||
for (const value of invalidValues) { | ||
await expectAsync( | ||
reconfigureServer({ | ||
appName: 'coolapp', | ||
publicServerURL: 'http://localhost:1337/1', | ||
emailAdapter: MockEmailAdapterWithOptions({ | ||
fromAddress: '[email protected]', | ||
apiKey: 'k', | ||
domain: 'd', | ||
}), | ||
passwordPolicy: { | ||
resetPasswordSuccessOnInvalidEmail: value, | ||
}, | ||
}) | ||
).toBeRejectedWith('resetPasswordSuccessOnInvalidEmail must be a boolean value'); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters