diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js index 998ca5620..a0267aaa4 100644 --- a/app/templates/Gruntfile.js +++ b/app/templates/Gruntfile.js @@ -16,7 +16,6 @@ module.exports = function (grunt) { ngtemplates: 'grunt-angular-templates', cdnify: 'grunt-google-cdn', protractor: 'grunt-protractor-runner', - injector: 'grunt-asset-injector', buildcontrol: 'grunt-build-control' }); diff --git a/app/templates/_bower.json b/app/templates/_bower.json index 1681050a2..ce22650fb 100644 --- a/app/templates/_bower.json +++ b/app/templates/_bower.json @@ -4,8 +4,7 @@ "dependencies": { "angular": ">=1.2.*", "json3": "~3.3.1", - "es5-shim": "~3.0.1", - "jquery": "~1.11.0",<% if(filters.bootstrap) { %><% if (filters.sass) { %> + "es5-shim": "~3.0.1",<% if(filters.bootstrap) { %><% if (filters.sass) { %> "bootstrap-sass-official": "~3.1.1",<% } %> "bootstrap": "~3.1.1",<% } %> "angular-resource": ">=1.2.*", diff --git a/app/templates/_package.json b/app/templates/_package.json index e32849740..a12359e8c 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -58,7 +58,7 @@ "grunt-angular-templates": "^0.5.4", "grunt-dom-munger": "^3.4.0", "grunt-protractor-runner": "^1.1.0", - "grunt-asset-injector": "^0.1.0", + "grunt-injector": "~0.5.4", "grunt-karma": "~0.8.2", "grunt-build-control": "DaftMonk/grunt-build-control", "grunt-mocha-test": "~0.10.2",<% if(filters.sass) { %> diff --git a/app/templates/server/api/user(auth)/user.controller.js b/app/templates/server/api/user(auth)/user.controller.js index f4cd10c29..ee3d56387 100644 --- a/app/templates/server/api/user(auth)/user.controller.js +++ b/app/templates/server/api/user(auth)/user.controller.js @@ -86,7 +86,7 @@ exports.me = function(req, res, next) { var userId = req.user._id; User.findOne({ _id: userId - }, '-salt -hashedPassword', function(err, user) { // don't ever give out the password or salt + }, function(err, user) { // don't ever give out the password or salt if (err) return next(err); if (!user) return res.json(401); res.json(user); diff --git a/app/templates/server/api/user(auth)/user.model.js b/app/templates/server/api/user(auth)/user.model.js index cc8d59263..ef51ba493 100644 --- a/app/templates/server/api/user(auth)/user.model.js +++ b/app/templates/server/api/user(auth)/user.model.js @@ -12,9 +12,9 @@ var UserSchema = new Schema({ type: String, default: 'user' }, - hashedPassword: String, + hashedPassword: {type: String, select: false}, provider: String, - salt: String<% if (filters.oauth) { %>,<% if (filters.facebookAuth) { %> + salt: {type: String, select: false}<% if (filters.oauth) { %>,<% if (filters.facebookAuth) { %> facebook: {},<% } %><% if (filters.twitterAuth) { %> twitter: {},<% } %><% if (filters.googleAuth) { %> google: {},<% } %> diff --git a/app/templates/server/api/user(auth)/user.model.spec.js b/app/templates/server/api/user(auth)/user.model.spec.js index 257c95b7c..f8bd4caa0 100644 --- a/app/templates/server/api/user(auth)/user.model.spec.js +++ b/app/templates/server/api/user(auth)/user.model.spec.js @@ -50,6 +50,26 @@ describe('User Model', function() { }); }); + it('should not have salt by default', function(done) { + user.save(function() { + }); + + User.find({name: user.name}, function(err, _user) { + _user.should.not.have.property('salt'); + done(); + }); + }); + + it('should not have hashedPassword by default', function(done) { + user.save(function() { + }); + + User.find({name: user.name}, function(err, _user) { + _user.should.not.have.property('hashedPassword'); + done(); + }); + }); + it("should authenticate user if password is valid", function() { return user.authenticate('password').should.be.true; }); diff --git a/app/templates/server/auth(auth)/local/passport.js b/app/templates/server/auth(auth)/local/passport.js index ac82b42a2..8b06ed462 100644 --- a/app/templates/server/auth(auth)/local/passport.js +++ b/app/templates/server/auth(auth)/local/passport.js @@ -9,7 +9,7 @@ exports.setup = function (User, config) { function(email, password, done) { User.findOne({ email: email.toLowerCase() - }, function(err, user) { + }, '+salt +hashedPassword', function(err, user) { if (err) return done(err); if (!user) { diff --git a/app/templates/server/routes.js b/app/templates/server/routes.js index c2b5acb2e..ebcd79dc6 100644 --- a/app/templates/server/routes.js +++ b/app/templates/server/routes.js @@ -5,6 +5,7 @@ 'use strict'; var errors = require('./components/errors'); +var path = require('path'); module.exports = function(app) { @@ -21,6 +22,6 @@ module.exports = function(app) { // All other routes should redirect to the index.html app.route('/*') .get(function(req, res) { - res.sendfile(app.get('appPath') + '/index.html'); + res.sendFile(path.resolve(app.get('appPath') + '/index.html')); }); }; diff --git a/readme.md b/readme.md index da6a851d1..31836c2a2 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# AngularJS Full-Stack generator [![Build Status](https://travis-ci.org/DaftMonk/generator-angular-fullstack.svg?branch=master)](http://travis-ci.org/DaftMonk/generator-angular-fullstack) +# AngularJS Full-Stack generator [![Build Status](https://travis-ci.org/DaftMonk/generator-angular-fullstack.svg?branch=master)](http://travis-ci.org/DaftMonk/generator-angular-fullstack) [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/DaftMonk/generator-angular-fullstack) > Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node - lets you quickly set up a project following best practices. @@ -198,7 +198,7 @@ Produces: client/app/myService/myService.service.spec.js -You can also do `yo angular:factory` and `yo angular:provider` for other types of services. +You can also do `yo angular-fullstack:factory` and `yo angular-fullstack:provider` for other types of services. ### Decorator Generates an AngularJS service decorator. diff --git a/test/fixtures/package.json b/test/fixtures/package.json index ce4df22f9..856e4fcc2 100644 --- a/test/fixtures/package.json +++ b/test/fixtures/package.json @@ -58,7 +58,7 @@ "grunt-angular-templates": "^0.5.4", "grunt-dom-munger": "^3.4.0", "grunt-protractor-runner": "^1.1.0", - "grunt-asset-injector": "^0.1.0", + "grunt-injector": "~0.5.4", "grunt-karma": "~0.8.2", "grunt-build-control": "DaftMonk/grunt-build-control", "grunt-mocha-test": "~0.10.2",