0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Changed /authentication/reset_all_passwords to return 204 response code

refs https://github.com/TryGhost/Toolbox/issues/308

- this endpoint has no body to return but it was initially implemented
  as returning a 200 which we couldn't change until 5.0
- this changes it to a 204, removes the serializer and updates tests to
  take this into account
This commit is contained in:
Daniel Lockyer 2022-04-25 17:21:19 +01:00
parent 379f64428e
commit cfa2f0e102
No known key found for this signature in database
GPG key ID: D21186F0B47295AD
4 changed files with 5 additions and 11 deletions

View file

@ -221,6 +221,7 @@ module.exports = {
},
resetAllPasswords: {
statusCode: 204,
permissions: true,
async query(frame) {
await userService.resetAllPasswords(frame.options);

View file

@ -47,10 +47,6 @@ module.exports = {
};
},
resetAllPasswords(data, apiConfig, frame) {
frame.response = data;
},
acceptInvitation(data, apiConfig, frame) {
debug('acceptInvitation');

View file

@ -449,14 +449,12 @@ Object {
}
`;
exports[`Authentication API Reset all passwords reset all passwords returns 200 1: [headers] 1`] = `
exports[`Authentication API Reset all passwords reset all passwords returns 204 1: [headers] 1`] = `
Object {
"access-control-allow-origin": "http://127.0.0.1:2369",
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
"content-length": "2",
"content-type": "application/json; charset=utf-8",
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
"vary": "Origin, Accept-Encoding",
"vary": "Origin",
"x-powered-by": "Express",
}
`;

View file

@ -478,12 +478,11 @@ describe('Authentication API', function () {
mockManager.restore();
});
it('reset all passwords returns 200', async function () {
it('reset all passwords returns 204', async function () {
await agent.post('authentication/reset_all_passwords')
.header('Accept', 'application/json')
.body({})
// @TODO: change to a 204 in 5.0
.expectStatus(200)
.expectStatus(204)
.expectEmptyBody()
.matchHeaderSnapshot({
etag: anyEtag