flatiron-persona
Version:
Flatiron plugin for user authentication with Mozilla Persona
33 lines (27 loc) • 989 B
JavaScript
// Generated by CoffeeScript 1.6.3
(function() {
var $, debug;
debug = require("debug");
$ = debug("persona:logout");
module.exports = function() {
var _this = this;
if (this.req.session == null) {
throw new Error("flatiron-persona: There is no session object in request.\n\n Flatiron Persona plugin needs to set @req.session.username to indicate that user is authenticated.\n\n Make sure your application supports session. You may use connect session middleware, as shown here: https://github.com/lzrski/flatiron-persona#flatiron-persona");
}
$("Logging out %s", this.req.session.username);
return this.req.session.destroy(function(error) {
$ = debug("persona:logout:session-destroy");
if (error) {
$("logout: %j", error);
_this.res.json(500, {
error: "Logout error."
});
return;
}
return _this.res.json(200, {});
});
};
}).call(this);
/*
//@ sourceMappingURL=logout.map
*/