Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #49 from niftylettuce/master

Added recipe #6
  • Loading branch information...
commit 054f5702470f2063f4f5927e433cb3678d658c93 2 parents 4a54ae5 + 02e8127
@bnoguchi bnoguchi authored
Showing with 28 additions and 0 deletions.
  1. +28 −0 README.md
View
28 README.md
@@ -493,6 +493,34 @@ mongoose.model('User', UserSchema);
User = mongoose.model('User');
```
+## Recipe 6: Customizing logout handler
+
+This is a copy of instructions from `everyauth` and applied to `mongoose-auth`:
+
+```javascript
+// ...
+UserSchema.plugin(mongooseAuth, {
+ everymodule: {
+ everyauth: {
+ User: function () {
+ return User;
+ },
+ handleLogout: function(req, res) {
+ // Put your extra logic here
+ req.logout(); // The logout method is added for you by everyauth, too
+ // And/or put your extra logic here
+ res.writeHead(303, { 'Location': this.logoutRedirectPath() });
+ res.end();
+ }
+ }
+ }
+ // ...
+});
+// ...
+```
+
+
+
### License
MIT License
Please sign in to comment.
Something went wrong with that request. Please try again.