Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added recipe #6 #49

Merged
merged 1 commit into from

2 participants

niftylettuce Brian Noguchi
niftylettuce

This recipe is a copy of instructions from everyauth for customizing the logout handler.

Brian Noguchi bnoguchi merged commit 054f570 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 29, 2011
  1. niftylettuce
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 0 deletions.
  1. +28 −0 README.md
28 README.md
View
@@ -495,6 +495,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
Something went wrong with that request. Please try again.