Skip to content

Commit 0af5cdc

Browse files
committed
2 parents 56d12fc + 5ba969b commit 0af5cdc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+362
-337
lines changed

Diff for: CHANGELOG.md

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1+
<a name="3.0.2"></a>
2+
## [3.0.2](https://github.com/DaftMonk/generator-angular-fullstack/compare/3.0.1...3.0.2) (2015-12-05)
3+
4+
5+
### Bug Fixes
6+
7+
* **api:user:** remove `password` before sending user objects instead of `hashedPassword` ([c08bd95](https://github.com/DaftMonk/generator-angular-fullstack/commit/c08bd95)), closes [#1459](https://github.com/DaftMonk/generator-angular-fullstack/issues/1459)
8+
* **client:auth:** remove decorator logic ([3229acd](https://github.com/DaftMonk/generator-angular-fullstack/commit/3229acd)), closes [#1455](https://github.com/DaftMonk/generator-angular-fullstack/issues/1455)
9+
10+
<a name="3.0.1"></a>
11+
## [3.0.1](https://github.com/DaftMonk/generator-angular-fullstack/compare/3.0.0...3.0.1) (2015-12-04)
12+
13+
14+
This version just changes the recommended Node version to ^4.2.3, since it fixes some vulnerabilities. Also, the Travis-CI config has been changed to loosely test Node 5.1.1 instead of 5.0.0.
15+
16+
117
<a name="3.0.0"></a>
218
# [3.0.0](https://github.com/DaftMonk/generator-angular-fullstack/compare/2.1.1...3.0.0) (2015-12-06)
319

4-
# 3.0.0
5-
620
### New Features
721

822
* **Sequelize** - You can now choose between MongoDB + Mongoose or SQLite3 + Sequelize

Diff for: app/templates/client/app/admin(auth)/admin(css).css

+18
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
11
.trash { color:rgb(209, 91, 71); }
2+
3+
.user-list li {
4+
display: flex;
5+
border: none;
6+
border-bottom: 1px lightgray solid;
7+
margin-bottom: 0;
8+
}
9+
.user-list li:last-child {
10+
border-bottom: none;
11+
}
12+
.user-list li .user-info {
13+
flex-grow: 1;
14+
}
15+
.user-list li .trash {
16+
display: flex;
17+
align-items: center;
18+
text-decoration: none;
19+
}

Diff for: app/templates/client/app/admin(auth)/admin(html).html

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
<div class="container">
44
<p>The delete user and user index api routes are restricted to users with the 'admin' role.</p>
5-
<ul class="list-group">
5+
<ul class="list-group user-list">
66
<li class="list-group-item" ng-repeat="user in admin.users">
7-
<strong>{{user.name}}</strong><br>
8-
<span class="text-muted">{{user.email}}</span>
9-
<a ng-click="admin.delete(user)" class="trash"><span class="glyphicon glyphicon-trash pull-right"></span></a>
7+
<div class="user-info">
8+
<strong>{{user.name}}</strong><br>
9+
<span class="text-muted">{{user.email}}</span>
10+
</div>
11+
<a ng-click="admin.delete(user)" class="trash"><span class="fa fa-trash fa-2x"></span></a>
1012
</li>
1113
</ul>
1214
</div>
+19
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
11
.trash { color:rgb(209, 91, 71); }
2+
3+
.user-list {
4+
li {
5+
display: flex;
6+
border: none;
7+
border-bottom: 1px lightgray solid;
8+
margin-bottom: 0;
9+
&:last-child { border-bottom: none; }
10+
11+
.user-info {
12+
flex-grow: 1;
13+
}
14+
.trash {
15+
display: flex;
16+
align-items: center;
17+
text-decoration: none;
18+
}
19+
}
20+
}
+19
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
11
.trash { color:rgb(209, 91, 71); }
2+
3+
.user-list {
4+
li {
5+
display: flex;
6+
border: none;
7+
border-bottom: 1px lightgray solid;
8+
margin-bottom: 0;
9+
&:last-child { border-bottom: none; }
10+
11+
.user-info {
12+
flex-grow: 1;
13+
}
14+
.trash {
15+
display: flex;
16+
align-items: center;
17+
text-decoration: none;
18+
}
19+
}
20+
}
+15
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
.trash
22
color rgb(209, 91, 71)
3+
4+
.user-list li
5+
display: flex
6+
border: none
7+
border-bottom: 1px lightgray solid
8+
margin-bottom: 0
9+
&:last-child
10+
border-bottom: none
11+
12+
.user-info
13+
flex-grow: 1
14+
.trash
15+
display: flex
16+
align-items: center
17+
text-decoration: none

Diff for: app/templates/client/app/admin(auth)/admin.controller.js

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
(function() {
44

55
class AdminController {
6-
76
constructor(User) {
87
// Use the User $resource to fetch all users
98
this.users = User.query();

Diff for: app/templates/client/components/auth(auth)/auth.service.js

+27-27
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,31 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
2020
* @param {Function} callback - optional, function(error, user)
2121
* @return {Promise}
2222
*/
23-
login: function(user, callback) {
23+
login(user, callback) {
2424
return $http.post('/auth/local', {
2525
email: user.email,
2626
password: user.password
2727
})
28-
.then(function(res) {
29-
$cookies.put('token', res.data.token);
30-
currentUser = User.get();
31-
return currentUser.$promise;
32-
})
33-
.then(function(user) {
34-
safeCb(callback)(null, user);
35-
return user;
36-
})
37-
.catch(function(err) {
38-
Auth.logout();
39-
safeCb(callback)(err.data);
40-
return $q.reject(err.data);
41-
});
28+
.then(res => {
29+
$cookies.put('token', res.data.token);
30+
currentUser = User.get();
31+
return currentUser.$promise;
32+
})
33+
.then(user => {
34+
safeCb(callback)(null, user);
35+
return user;
36+
})
37+
.catch(err => {
38+
Auth.logout();
39+
safeCb(callback)(err.data);
40+
return $q.reject(err.data);
41+
});
4242
},
4343

4444
/**
4545
* Delete access token and user info
4646
*/
47-
logout: function() {
47+
logout() {
4848
$cookies.remove('token');
4949
currentUser = {};
5050
},
@@ -56,7 +56,7 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
5656
* @param {Function} callback - optional, function(error, user)
5757
* @return {Promise}
5858
*/
59-
createUser: function(user, callback) {
59+
createUser(user, callback) {
6060
return User.save(user,
6161
function(data) {
6262
$cookies.put('token', data.token);
@@ -77,7 +77,7 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
7777
* @param {Function} callback - optional, function(error, user)
7878
* @return {Promise}
7979
*/
80-
changePassword: function(oldPassword, newPassword, callback) {
80+
changePassword(oldPassword, newPassword, callback) {
8181
return User.changePassword({ id: currentUser._id }, {
8282
oldPassword: oldPassword,
8383
newPassword: newPassword
@@ -95,18 +95,18 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
9595
* @param {Function|*} callback - optional, funciton(user)
9696
* @return {Object|Promise}
9797
*/
98-
getCurrentUser: function(callback) {
98+
getCurrentUser(callback) {
9999
if (arguments.length === 0) {
100100
return currentUser;
101101
}
102102

103103
var value = (currentUser.hasOwnProperty('$promise')) ?
104104
currentUser.$promise : currentUser;
105105
return $q.when(value)
106-
.then(function(user) {
106+
.then(user => {
107107
safeCb(callback)(user);
108108
return user;
109-
}, function() {
109+
}, () => {
110110
safeCb(callback)({});
111111
return {};
112112
});
@@ -119,13 +119,13 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
119119
* @param {Function|*} callback - optional, function(is)
120120
* @return {Bool|Promise}
121121
*/
122-
isLoggedIn: function(callback) {
122+
isLoggedIn(callback) {
123123
if (arguments.length === 0) {
124124
return currentUser.hasOwnProperty('role');
125125
}
126126

127127
return Auth.getCurrentUser(null)
128-
.then(function(user) {
128+
.then(user => {
129129
var is = user.hasOwnProperty('role');
130130
safeCb(callback)(is);
131131
return is;
@@ -140,7 +140,7 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
140140
* @param {Function|*} callback - optional, function(has)
141141
* @return {Bool|Promise}
142142
*/
143-
hasRole: function(role, callback) {
143+
hasRole(role, callback) {
144144
var hasRole = function(r, h) {
145145
return userRoles.indexOf(r) >= userRoles.indexOf(h);
146146
};
@@ -150,7 +150,7 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
150150
}
151151

152152
return Auth.getCurrentUser(null)
153-
.then(function(user) {
153+
.then(user => {
154154
var has = (user.hasOwnProperty('role')) ?
155155
hasRole(user.role, role) : false;
156156
safeCb(callback)(has);
@@ -165,7 +165,7 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
165165
* @param {Function|*} callback - optional, function(is)
166166
* @return {Bool|Promise}
167167
*/
168-
isAdmin: function() {
168+
isAdmin() {
169169
return Auth.hasRole
170170
.apply(Auth, [].concat.apply(['admin'], arguments));
171171
},
@@ -175,7 +175,7 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
175175
*
176176
* @return {String} - a token string used for authenticating
177177
*/
178-
getToken: function() {
178+
getToken() {
179179
return $cookies.get('token');
180180
}
181181
};

Diff for: app/templates/client/components/auth(auth)/interceptor.service.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $
66
<% if (filters.uirouter) { %>var state;
77
<% } %>return {
88
// Add authorization token to headers
9-
request: function(config) {
9+
request(config) {
1010
config.headers = config.headers || {};
1111
if ($cookies.get('token') && Util.isSameOrigin(config.url)) {
1212
config.headers.Authorization = 'Bearer ' + $cookies.get('token');
@@ -15,7 +15,7 @@ function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $
1515
},
1616

1717
// Intercept 401s and redirect you to login
18-
responseError: function(response) {
18+
responseError(response) {
1919
if (response.status === 401) {
2020
<% if (filters.ngroute) { %>$location.path('/login');<% } if (filters.uirouter) { %>(state || (state = $injector.get('$state'))).go('login');<% } %>
2121
// remove any stale tokens

Diff for: app/templates/client/components/auth(auth)/user.service.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
function UserResource($resource) {
66
return $resource('/api/users/:id/:controller', {
77
id: '@_id'
8-
},
9-
{
8+
}, {
109
changePassword: {
1110
method: 'PUT',
1211
params: {

Diff for: app/templates/client/components/footer/footer.directive.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ angular.module('<%= scriptAppName %>')
55
return {
66
templateUrl: 'components/footer/footer.html',
77
restrict: 'E',
8-
link: function (scope, element) {
8+
link: function(scope, element) {
99
element.addClass('footer');
1010
}
1111
};

Diff for: app/templates/client/components/modal(uibootstrap)/modal.service.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ angular.module('<%= scriptAppName %>')
88
* @param {String} modalClass - (optional) class(es) to be applied to the modal
99
* @return {Object} - the instance $modal.open() returns
1010
*/
11-
function openModal(scope, modalClass) {
11+
function openModal(scope = {}, modalClass = 'modal-default') {
1212
var modalScope = $rootScope.$new();
13-
scope = scope || {};
14-
modalClass = modalClass || 'modal-default';
1513

1614
angular.extend(modalScope, scope);
1715

@@ -33,9 +31,7 @@ angular.module('<%= scriptAppName %>')
3331
* @param {Function} del - callback, ran when delete is confirmed
3432
* @return {Function} - the function to open the modal (ex. myModalFn)
3533
*/
36-
delete: function(del) {
37-
del = del || angular.noop;
38-
34+
delete(del = angular.noop) {
3935
/**
4036
* Open a delete confirmation modal
4137
* @param {String} name - name or info to show on modal

Diff for: app/templates/client/components/mongoose-error(auth)/mongoose-error.directive.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
* Removes server error when user updates input
55
*/
66
angular.module('<%= scriptAppName %>')
7-
.directive('mongooseError', function () {
7+
.directive('mongooseError', function() {
88
return {
99
restrict: 'A',
1010
require: 'ngModel',
1111
link: function(scope, element, attrs, ngModel) {
12-
element.on('keydown', function() {
13-
return ngModel.$setValidity('mongoose', true);
14-
});
12+
element.on('keydown', () => ngModel.$setValidity('mongoose', true));
1513
}
1614
};
1715
});

Diff for: app/templates/client/components/navbar/navbar.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class NavbarController {
1010
isCollapsed = true;
1111
//end-non-standard
1212

13-
constructor(<% if(!filters.uirouter) { %>$location<% } %><% if (filters.auth) { %>Auth<% } %>) {<% if(!filters.uirouter) { %>
13+
constructor(<% if(!filters.uirouter) { %>$location<% } if(!filters.uirouter && filters.auth) { %>, <% } if (filters.auth) { %>Auth<% } %>) {<% if(!filters.uirouter) { %>
1414
this.$location = $location;<% } %>
1515
<% if (filters.auth) { %>this.isLoggedIn = Auth.isLoggedIn;
1616
this.isAdmin = Auth.isAdmin;

Diff for: app/templates/client/components/socket(socketio)/socket.service.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@
33

44
angular.module('<%= scriptAppName %>')
55
.factory('socket', function(socketFactory) {
6-
76
// socket.io now auto-configures its connection when we ommit a connection url
87
var ioSocket = io('', {
98
// Send auth token on connection, you will need to DI the Auth service above
109
// 'query': 'token=' + Auth.getToken()
1110
path: '/socket.io-client'
1211
});
1312

14-
var socket = socketFactory({
15-
ioSocket: ioSocket
16-
});
13+
var socket = socketFactory({ ioSocket });
1714

1815
return {
19-
socket: socket,
16+
socket,
2017

2118
/**
2219
* Register listeners to sync an array with updates on a model
@@ -28,7 +25,7 @@ angular.module('<%= scriptAppName %>')
2825
* @param {Array} array
2926
* @param {Function} cb
3027
*/
31-
syncUpdates: function (modelName, array, cb) {
28+
syncUpdates(modelName, array, cb) {
3229
cb = cb || angular.noop;
3330

3431
/**
@@ -66,7 +63,7 @@ angular.module('<%= scriptAppName %>')
6663
*
6764
* @param modelName
6865
*/
69-
unsyncUpdates: function (modelName) {
66+
unsyncUpdates(modelName) {
7067
socket.removeAllListeners(modelName + ':save');
7168
socket.removeAllListeners(modelName + ':remove');
7269
}

0 commit comments

Comments
 (0)