Skip to content

Fix signup and fields #568

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 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6079484
Merge pull request #469 from kingcody/fix/order-of-operations
DaftMonk Aug 23, 2014
16f928b
Merge branch 'master' into canary
DaftMonk Aug 25, 2014
102078d
use more restrictive matching for serve-favicon version
DaftMonk Aug 25, 2014
c018ae8
Merge branch 'master' into canary
DaftMonk Aug 26, 2014
6aecdf7
feat(auth): make crypto async
Aug 26, 2014
de5c36c
refactor(server-tests): use sinon-chai and `mocha.conf.js`
kingcody Aug 29, 2014
dbbaa20
feat(server-tests): code coverage and e2e
kingcody Aug 30, 2014
4babb07
Merge pull request #505 from kingcody/feature/mocha-istanbul
DaftMonk Aug 30, 2014
5198685
fix(server-tests): `test:coverage` task
kingcody Aug 30, 2014
4859cc1
Merge pull request #507 from kingcody/fix/test-coverage
DaftMonk Aug 30, 2014
733f027
Merge branch 'canary' into pr/481
DaftMonk Sep 1, 2014
7045907
fix user model test
DaftMonk Sep 1, 2014
1ca7448
feat (mongoose): use mongoose-bird to promisify the mongoose API
pentateu Aug 25, 2014
49d5bbd
fix(gen): filter `client/components/socket` js files
kingcody Sep 7, 2014
c2ab8ae
test(gen): make tests more strict and DRY
kingcody Sep 7, 2014
c16b3c9
Merge pull request #531 from kingcody/refactor/gen-tests
DaftMonk Sep 10, 2014
a438c8f
Merge pull request #532 from kingcody/fix/client-components-socket
DaftMonk Sep 10, 2014
a330070
Merge branch 'master' into canary
DaftMonk Sep 10, 2014
3536b45
fix unexpected files created in tests
DaftMonk Sep 10, 2014
cf6ae00
test(gen): clean up code and test more endpoint combinations
kingcody Sep 10, 2014
7362080
fix(gen): camelCase endpoint name when used in variable name
kingcody Sep 10, 2014
125e367
Merge pull request #520 from kingcody/feature/mongoose-bird-rebase
DaftMonk Sep 14, 2014
09f92c9
Merge pull request #542 from kingcody/refactor/gen-tests
DaftMonk Sep 14, 2014
83eef83
Merge branch 'canary' of github.com:DaftMonk/generator-angular-fullst…
DaftMonk Sep 15, 2014
ac8f335
style(package): remove unneeded line break
DaftMonk Sep 15, 2014
502be54
remove fixtures that should not be git ignored
DaftMonk Sep 15, 2014
65d03fc
feat(app-auth): Improve client-side Auth service
kingcody Aug 17, 2014
2aaff12
fix typo
DaftMonk Sep 17, 2014
6aadee6
feat(app-routing): improve app routing
kingcody Aug 15, 2014
fb28c28
expect uirouter mocks in tests
DaftMonk Sep 17, 2014
18c6222
renamed password field for exclution
Sep 19, 2014
91c9223
jwt.sign was receiving not the correct ID because the async function …
Sep 19, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ demo
.idea
.DS_Store
release.txt
fixtures/bower.json
fixtures/package.json
test/fixtures/bower.json
test/fixtures/package.json
102 changes: 95 additions & 7 deletions app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = function (grunt) {
cdnify: 'grunt-google-cdn',
protractor: 'grunt-protractor-runner',
injector: 'grunt-asset-injector',
buildcontrol: 'grunt-build-control'
buildcontrol: 'grunt-build-control',
istanbul_check_coverage: 'grunt-mocha-istanbul'
});

// Time how long tasks take. Can help when optimizing build times
Expand Down Expand Up @@ -169,14 +170,14 @@ module.exports = function (grunt) {
},
src: [
'server/**/*.js',
'!server/**/*.spec.js'
'!server/**/*.{spec,e2e}.js'
]
},
serverTest: {
options: {
jshintrc: 'server/.jshintrc-spec'
},
src: ['server/**/*.spec.js']
src: ['server/**/*.{spec,e2e}.js']
},
all: [
'<%%= yeoman.client %>/{app,components}/**/*.js',
Expand Down Expand Up @@ -486,9 +487,60 @@ module.exports = function (grunt) {

mochaTest: {
options: {
reporter: 'spec'
reporter: 'spec',
require: 'mocha.conf.js'
},
src: ['server/**/*.spec.js']
unit: {
src: ['server/**/*.spec.js']
},
e2e: {
src: ['server/**/*.e2e.js']
}
},

mocha_istanbul: {
unit: {
options: {
excludes: [
'**/*.spec.js',
'**/*.mock.js',
'**/*.e2e.js'
],
reporter: 'spec',
require: ['mocha.conf.js'],
mask: '**/*.spec.js',
coverageFolder: 'coverage/server/unit'
},
src: 'server'
},
e2e: {
options: {
excludes: [
'**/*.spec.js',
'**/*.mock.js',
'**/*.e2e.js'
],
reporter: 'spec',
require: ['mocha.conf.js'],
mask: '**/*.e2e.js',
coverageFolder: 'coverage/server/e2e'
},
src: 'server'
}
},

istanbul_check_coverage: {
default: {
options: {
coverageFolder: 'coverage/**',
check: {
lines: 80,
statements: 80,
branches: 80,
functions: 80
}
}
}
},

protractor: {
Expand Down Expand Up @@ -764,12 +816,13 @@ module.exports = function (grunt) {
grunt.task.run(['serve']);
});

grunt.registerTask('test', function(target) {
grunt.registerTask('test', function(target, option) {
if (target === 'server') {
return grunt.task.run([
'env:all',
'env:test',
'mochaTest'
'mochaTest:unit',
'mochaTest:e2e'
]);
}

Expand Down Expand Up @@ -804,6 +857,41 @@ module.exports = function (grunt) {
]);
}

else if (target === 'coverage') {

if (option === 'unit') {
return grunt.task.run([
'env:all',
'env:test',
'mocha_istanbul:unit'
]);
}

else if (option === 'e2e') {
return grunt.task.run([
'env:all',
'env:test',
'mocha_istanbul:e2e'
]);
}

else if (option === 'check') {
return grunt.task.run([
'istanbul_check_coverage'
]);
}

else {
return grunt.task.run([
'env:all',
'env:test',
'mocha_istanbul',
'istanbul_check_coverage'
]);
}

}

else grunt.task.run([
'test:server',
'test:client'
Expand Down
12 changes: 8 additions & 4 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"lodash": "~2.4.1",<% if(filters.jade) { %>
"jade": "~1.2.0",<% } %><% if(filters.html) { %>
"ejs": "~0.8.4",<% } %><% if(filters.mongoose) { %>
"mongoose": "~3.8.8",<% } %><% if(filters.auth) { %>
"mongoose": "~3.8.8",
"mongoose-bird": "~0.0.1",<% } %><% if(filters.auth) { %>
"jsonwebtoken": "^0.3.0",
"express-jwt": "^0.1.3",
"passport": "~0.2.0",
Expand All @@ -30,6 +31,7 @@
"socketio-jwt": "^2.0.2"<% } %>
},
"devDependencies": {
"chai-as-promised": "^4.1.1",
"grunt": "~0.4.4",
"grunt-autoprefixer": "~0.7.2",
"grunt-wiredep": "~1.8.0",
Expand All @@ -45,7 +47,7 @@
"grunt-contrib-watch": "~0.6.1",<% if(filters.coffee) { %>
"grunt-contrib-coffee": "^0.10.1",<% } %><% if(filters.jade) { %>
"grunt-contrib-jade": "^0.11.0",<% } %><% if(filters.less) { %>
"grunt-contrib-less": "^0.11.0",<% } %>
"grunt-contrib-less": "^0.11.4",<% } %>
"grunt-google-cdn": "~0.4.0",
"grunt-newer": "~0.7.0",
"grunt-ng-annotate": "^0.2.3",
Expand All @@ -61,7 +63,8 @@
"grunt-asset-injector": "^0.1.0",
"grunt-karma": "~0.8.2",
"grunt-build-control": "DaftMonk/grunt-build-control",
"grunt-mocha-test": "~0.10.2",<% if(filters.sass) { %>
"grunt-mocha-test": "~0.10.2",
"grunt-mocha-istanbul": "^2.0.0",<% if(filters.sass) { %>
"grunt-contrib-sass": "^0.7.3",<% } %><% if(filters.stylus) { %>
"grunt-contrib-stylus": "latest",<% } %>
"jit-grunt": "^0.5.0",
Expand All @@ -85,8 +88,9 @@
"karma-phantomjs-launcher": "~0.1.4",
"karma": "~0.12.9",
"karma-ng-html2js-preprocessor": "~0.1.0",
"proxyquire": "^1.0.1",
"supertest": "~0.11.0",
"should": "~3.3.1"
"sinon-chai": "^2.5.0"
},
"engines": {
"node": ">=0.10.0"
Expand Down
26 changes: 25 additions & 1 deletion app/templates/client/app/account(auth)/account(coffee).coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ angular.module '<%= scriptAppName %>'
templateUrl: 'app/account/login/login.html'
controller: 'LoginCtrl'

.when '/logout',
name: 'logout'
referrer: '/'
controller: ($location, $route, Auth) ->
referrer = $route.current.params.referrer or $route.current.referrer or "/"
Auth.logout()
$location.path referrer

.when '/signup',
templateUrl: 'app/account/signup/signup.html'
controller: 'SignupCtrl'
Expand All @@ -15,13 +23,25 @@ angular.module '<%= scriptAppName %>'
templateUrl: 'app/account/settings/settings.html'
controller: 'SettingsCtrl'
authenticate: true

.run ($rootScope) ->
$rootScope.$on '$routeChangeStart', (event, next, current) ->
next.referrer = current.originalPath if next.name is "logout" and current and current.originalPath and not current.authenticate
<% } %><% if(filters.uirouter) { %>.config ($stateProvider) ->
$stateProvider
.state 'login',
url: '/login'
templateUrl: 'app/account/login/login.html'
controller: 'LoginCtrl'

.state 'logout',
url: '/logout?referrer'
referrer: 'main'
controller: ($state, Auth) ->
referrer = $state.params.referrer or $state.current.referrer or "main"
Auth.logout()
$state.go referrer

.state 'signup',
url: '/signup'
templateUrl: 'app/account/signup/signup.html'
Expand All @@ -32,4 +52,8 @@ angular.module '<%= scriptAppName %>'
templateUrl: 'app/account/settings/settings.html'
controller: 'SettingsCtrl'
authenticate: true
<% } %>

.run ($rootScope) ->
$rootScope.$on '$stateChangeStart', (event, next, nextParams, current) ->
next.referrer = current.name if next.name is "logout" and current and current.name and not current.authenticate
<% } %>
38 changes: 37 additions & 1 deletion app/templates/client/app/account(auth)/account(js).js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ angular.module('<%= scriptAppName %>')
templateUrl: 'app/account/login/login.html',
controller: 'LoginCtrl'
})
.when('/logout', {
name: 'logout',
referrer: '/',
controller: function($location, $route, Auth) {
var referrer = $route.current.params.referrer ||
$route.current.referrer ||
'/';
Auth.logout();
$location.path(referrer);
}
})
.when('/signup', {
templateUrl: 'app/account/signup/signup.html',
controller: 'SignupCtrl'
Expand All @@ -16,13 +27,31 @@ angular.module('<%= scriptAppName %>')
controller: 'SettingsCtrl',
authenticate: true
});
})
.run(function($rootScope) {
$rootScope.$on('$routeChangeStart', function(event, next, current) {
if (next.name === 'logout' && current && current.originalPath && !current.authenticate) {
next.referrer = current.originalPath;
}
});
});<% } %><% if(filters.uirouter) { %>.config(function ($stateProvider) {
$stateProvider
.state('login', {
url: '/login',
templateUrl: 'app/account/login/login.html',
controller: 'LoginCtrl'
})
.state('logout', {
url: '/logout?referrer',
referrer: 'main',
controller: function($state, Auth) {
var referrer = $state.params.referrer ||
$state.current.referrer ||
'main';
Auth.logout();
$state.go(referrer);
}
})
.state('signup', {
url: '/signup',
templateUrl: 'app/account/signup/signup.html',
Expand All @@ -34,4 +63,11 @@ angular.module('<%= scriptAppName %>')
controller: 'SettingsCtrl',
authenticate: true
});
});<% } %>
})
.run(function($rootScope) {
$rootScope.$on('$stateChangeStart', function(event, next, nextParams, current) {
if (next.name === 'logout' && current && current.name && !current.authenticate) {
next.referrer = current.name;
}
});
});<% } %>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1>Login</h1>
<button class="btn btn-inverse btn-lg btn-login" type="submit">
Login
</button>
<a class="btn btn-default btn-lg btn-register" href="/signup">
<a class="btn btn-default btn-lg btn-register" <% if(filters.uirouter) { %>ui-sref="signup"<% } else { %>href="/signup"<% } %>>
Register
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ div(ng-include='"components/navbar/navbar.html"')
button.btn.btn-inverse.btn-lg.btn-login(type='submit')
| Login
= ' '
a.btn.btn-default.btn-lg.btn-register(href='/signup')
a.btn.btn-default.btn-lg.btn-register(<% if(filters.uirouter) { %>ui-sref='signup'<% } else { %>href='/signup'<% } %>)
| Register
<% if(filters.oauth) {%>
hr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict'

angular.module '<%= scriptAppName %>'
.controller 'LoginCtrl', ($scope, Auth, $location<% if(filters.oauth) {%>, $window<% } %>) ->
.controller 'LoginCtrl', ($scope, Auth<% if(filters.ngroute) { %>, $location<% } %><% if(filters.uirouter) { %>, $state<% } %><% if(filters.oauth) {%>, $window<% } %>) ->
$scope.user = {}
$scope.errors = {}
$scope.login = (form) ->
Expand All @@ -14,7 +14,7 @@ angular.module '<%= scriptAppName %>'
password: $scope.user.password

.then ->
$location.path '/'
<% if(filters.ngroute) { %>$location.path '/'<% } %><% if(filters.uirouter) { %>$state.go 'main'<% } %>

.catch (err) ->
$scope.errors.other = err.message
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

angular.module('<%= scriptAppName %>')
.controller('LoginCtrl', function ($scope, Auth, $location<% if (filters.oauth) { %>, $window<% } %>) {
.controller('LoginCtrl', function ($scope, Auth<% if(filters.ngroute) { %>, $location<% } %><% if(filters.uirouter) { %>, $state<% } %><% if (filters.oauth) { %>, $window<% } %>) {
$scope.user = {};
$scope.errors = {};

Expand All @@ -15,7 +15,7 @@ angular.module('<%= scriptAppName %>')
})
.then( function() {
// Logged in, redirect to home
$location.path('/');
<% if(filters.ngroute) { %>$location.path('/');<% } %><% if(filters.uirouter) { %>$state.go('main');<% } %>
})
.catch( function(err) {
$scope.errors.other = err.message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h1>Sign up</h1>
<button class="btn btn-inverse btn-lg btn-login" type="submit">
Sign up
</button>
<a class="btn btn-default btn-lg btn-register" href="/login">
<a class="btn btn-default btn-lg btn-register" <% if(filters.uirouter) { %>ui-sref="login"<% } else { %>href="/login"<% } %>>
Login
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ div(ng-include='"components/navbar/navbar.html"')
button.btn.btn-inverse.btn-lg.btn-login(type='submit')
| Sign up
= ' '
a.btn.btn-default.btn-lg.btn-register(href='/login')
a.btn.btn-default.btn-lg.btn-register(<% if(filters.uirouter) { %>ui-sref='login'<% } else { %>href='/login'<% } %>)
| Login

<% if(filters.oauth) {%>
Expand Down
Loading