This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This code doesn't accept a URL of /auth/twitter or /auth/github | |
| var express = require('express') | |
| , routes = require('./routes') | |
| , util = require('util') | |
| , everyauth = require('everyauth'); | |
| var app = module.exports = express.createServer(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bootstrapAuthentication() | |
| application = express.createServer() | |
| application.configure -> | |
| bootstrap(application) | |
| application.listen(2536) | |
| bootstrapAuthentication = () -> | |
| everyauth.twitter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| findOrCreateUser: function (sess, accessTok, accessTokExtra, fbUser) { | |
| var promise = this.Promise() | |
| , User = this.User()(); | |
| if(sess.auth == null || sess.auth.userId == null) { | |
| User.findOne({'fb.id': fbUser.id}, function (err, foundUser) { | |
| if (foundUser) { | |
| if( foundUser.confirmed ) { | |
| return promise.fulfill(foundUser); | |
| } else { | |
| assignFbDataToUser(foundUser, accessTok, accessTokExtra, fbUser); |