Skip to content

Pr/569 #618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
1 change: 0 additions & 1 deletion app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
});

Expand Down
3 changes: 1 addition & 2 deletions app/templates/_bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.*",
Expand Down
2 changes: 1 addition & 1 deletion app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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) { %>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/server/api/user(auth)/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions app/templates/server/api/user(auth)/user.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},<% } %>
Expand Down
20 changes: 20 additions & 0 deletions app/templates/server/api/user(auth)/user.model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion app/templates/server/auth(auth)/local/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion app/templates/server/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'use strict';

var errors = require('./components/errors');
var path = require('path');

module.exports = function(app) {

Expand All @@ -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'));
});
};
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down