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
Host heroku.com | |
Hostname heroku.com | |
Port 22 | |
IdentitiesOnly yes | |
IdentityFile ~/.ssh/heroku_rsa | |
TCPKeepAlive yes | |
User [email protected] | |
ForwardAgent yes |
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
npm http GET https://registry.npmjs.org/up | |
npm ERR! git clone [email protected]:Igniter/starscape-auth.git Initialized empty Git repository in /tmp/build_3flfct30tzftp/tmp/npm-3420/1352223283745-0.15098921791650355/.git/ | |
npm ERR! git clone [email protected]:Igniter/starscape-auth.git | |
npm ERR! git clone [email protected]:Igniter/starscape-auth.git Host key verification failed. | |
npm ERR! git clone [email protected]:Igniter/starscape-auth.git fatal: The remote end hung up unexpectedly | |
npm ERR! git clone [email protected]:Igniter/starscape-models.git Initialized empty Git repository in /tmp/build_3flfct30tzftp/tmp/npm-3420/1352223283716-0.3042264792602509/.git/ | |
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
Model.addOrganization = function(model, organizationId, done) { | |
console.log("model:", model, "organizationId" , organizationId ) | |
Model.save({_id:model._id, $addToSet: {organizations: toObjectId(organizationId)}}, function(err) { | |
console.log(err); | |
done(null, model); | |
}) | |
} |
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
Model.hasOrganization = function (model, organization) { | |
if (!model.organizations) return false; | |
var organizationsIds = model.organizations.map(function(o){return o._id}); | |
console.log("CHEKCING : orgs", organizationsIds, "orgId", organization._id, organizationsIds.filter(function(id){id === organization._id})) | |
return organizationsIds.indexOf(organization._id) != -1 | |
} |
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
Model.addUser = function(model, user, done) { | |
User.save({_id: toObjectId(model), $addToSet: {organizations: toObjectId(model)}}, function(err, user) { | |
// user.organizations || (user.organizations = []); | |
// user.organizations.push(toObjectId(model)); | |
done(null, user); | |
}); | |
}; |
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
function checkUserTags(user) { | |
var tags = user.tags | |
var newTags = []; | |
console.log( "Checking user", user._id) | |
if (tags.length > 0) { | |
tags.forEach(function (tagName, i) { | |
console.log("user", user._id, tagName, i); |
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
.navbar.navbar-fixed-top | |
.navbar-inner | |
.container-fluid.mobile | |
a(href='/#').brand | |
img(src='/img/devscapeD.png') | |
.dropdown.nav.pull-right | |
a(role="button", data-toggle="dropdown", data-target="#", href="#").dropdown-toggle#dLabel | |
if(user && user.name) | |
=user.name.toLowerCase() | |
else |
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
app.post('/login', function(req, res) { | |
User | |
.where('email', req.body.email) | |
.populate('organizations') | |
.findOne(function(err, user) { | |
if(user) { | |
console.log(user); | |
user.authenticate(req.body.password, function(err) { | |
if(!err) { | |
req.session._userId = user.get('id'); |
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
var OrganizationRouter = module.exports = Backbone.Router.extend({ | |
routes: { | |
'o/:organizationName': 'show' | |
, 'createOrganization': 'add' | |
} | |
, show: function (orgUserName) { | |
$('body').removeClass(); | |
$('body').addClass('organizations'); | |
// var org = new Organization({id : orgUserName}); |
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
, show: function (orgUserName) { | |
$('body').removeClass(); | |
$('body').addClass('organizations'); | |
var org = new Organization({id : orgUserName}); | |
org.fetch(); | |
var view = new OrganizationView({model: org}); | |
Application. |