Updated logout handling per review.
This commit is contained in:
11
src/users.js
11
src/users.js
@@ -167,14 +167,17 @@ function handleDelete(req) {
|
|||||||
function handleLogOut(req) {
|
function handleLogOut(req) {
|
||||||
var success = {response: {}};
|
var success = {response: {}};
|
||||||
if (req.info && req.info.sessionToken) {
|
if (req.info && req.info.sessionToken) {
|
||||||
rest.find(req.config, Auth.master(req.config), '_Session',
|
return rest.find(req.config, Auth.master(req.config), '_Session',
|
||||||
{_session_token: req.info.sessionToken}
|
{_session_token: req.info.sessionToken}
|
||||||
).then((records) => {
|
).then((records) => {
|
||||||
if (records.results && records.results.length) {
|
if (records.results && records.results.length) {
|
||||||
rest.del(req.config, Auth.master(req.config), '_Session',
|
return rest.del(req.config, Auth.master(req.config), '_Session',
|
||||||
records.results[0].id
|
records.results[0].objectId
|
||||||
);
|
).then(() => {
|
||||||
|
return Promise.resolve(success);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
return Promise.resolve(success);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Promise.resolve(success);
|
return Promise.resolve(success);
|
||||||
|
|||||||
Reference in New Issue
Block a user