mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -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:
parent
379f64428e
commit
cfa2f0e102
4 changed files with 5 additions and 11 deletions
|
@ -221,6 +221,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
|
|
||||||
resetAllPasswords: {
|
resetAllPasswords: {
|
||||||
|
statusCode: 204,
|
||||||
permissions: true,
|
permissions: true,
|
||||||
async query(frame) {
|
async query(frame) {
|
||||||
await userService.resetAllPasswords(frame.options);
|
await userService.resetAllPasswords(frame.options);
|
||||||
|
|
|
@ -47,10 +47,6 @@ module.exports = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
resetAllPasswords(data, apiConfig, frame) {
|
|
||||||
frame.response = data;
|
|
||||||
},
|
|
||||||
|
|
||||||
acceptInvitation(data, apiConfig, frame) {
|
acceptInvitation(data, apiConfig, frame) {
|
||||||
debug('acceptInvitation');
|
debug('acceptInvitation');
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
Object {
|
||||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
"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",
|
"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 \\]\\|\\\\\\\\\\.\\)\\*"/,
|
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||||
"vary": "Origin, Accept-Encoding",
|
"vary": "Origin",
|
||||||
"x-powered-by": "Express",
|
"x-powered-by": "Express",
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -478,12 +478,11 @@ describe('Authentication API', function () {
|
||||||
mockManager.restore();
|
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')
|
await agent.post('authentication/reset_all_passwords')
|
||||||
.header('Accept', 'application/json')
|
.header('Accept', 'application/json')
|
||||||
.body({})
|
.body({})
|
||||||
// @TODO: change to a 204 in 5.0
|
.expectStatus(204)
|
||||||
.expectStatus(200)
|
|
||||||
.expectEmptyBody()
|
.expectEmptyBody()
|
||||||
.matchHeaderSnapshot({
|
.matchHeaderSnapshot({
|
||||||
etag: anyEtag
|
etag: anyEtag
|
||||||
|
|
Loading…
Add table
Reference in a new issue