mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-06-04 19:42:50 +08:00
fixed logout error due to missing sid
This commit is contained in:
@@ -32,6 +32,11 @@ module.exports = function (req, res, next) {
|
||||
// skip without a resource
|
||||
if(!resource) return next({error: 'Could not find a resource to validate.', status: 404});
|
||||
|
||||
// default _id to current user when logging out
|
||||
if(resource.type === 'UserCollection' && req.url.indexOf('/logout') === req.url.lastIndexOf('/')) {
|
||||
req.query._id = req.session._id;
|
||||
}
|
||||
|
||||
// if modifying data, require an id
|
||||
if((req.method === 'PUT' || req.method === 'DELETE') && (!req.query || !req.query._id)) {
|
||||
return next({error: 'An _id must be included when modifying a resource.'});
|
||||
|
||||
@@ -53,7 +53,7 @@ describe('Users', function(){
|
||||
// TODO fix mdoq-http bug - loses context if replace client with users
|
||||
users.use('/login').post({email: data.users[0].email, password: data.users[0].password}, function (err, session, req, res) {
|
||||
// SHOULD BE USERS
|
||||
client.use('/users/logout').del(function (err, res) {
|
||||
unauthed.use('/users/logout').del(function (err, res) {
|
||||
done(err);
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user