mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-07 07:33:03 +02:00
feat(users): Modify users module to implement style guidelines.
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Configuring the Users module
|
||||
angular.module('users.admin').run(['Menus',
|
||||
function (Menus) {
|
||||
angular
|
||||
.module('users.admin')
|
||||
.run(menuConfig);
|
||||
|
||||
menuConfig.$inject = ['Menus'];
|
||||
|
||||
// Configuring the Users module
|
||||
function menuConfig(Menus) {
|
||||
Menus.addSubMenuItem('topbar', 'admin', {
|
||||
title: 'Manage Users',
|
||||
state: 'admin.users'
|
||||
});
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Setting up route
|
||||
angular.module('users.admin.routes').config(['$stateProvider',
|
||||
function ($stateProvider) {
|
||||
// Setting up route
|
||||
angular
|
||||
.module('users.admin.routes')
|
||||
.config(routeConfig);
|
||||
|
||||
routeConfig.$inject = ['$stateProvider'];
|
||||
|
||||
function routeConfig($stateProvider) {
|
||||
$stateProvider
|
||||
.state('admin.users', {
|
||||
url: '/users',
|
||||
templateUrl: 'modules/users/client/views/admin/list-users.client.view.html',
|
||||
controller: 'UserListController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Users List'
|
||||
}
|
||||
@@ -16,12 +23,9 @@ angular.module('users.admin.routes').config(['$stateProvider',
|
||||
url: '/users/:userId',
|
||||
templateUrl: 'modules/users/client/views/admin/view-user.client.view.html',
|
||||
controller: 'UserController',
|
||||
controllerAs: 'vm',
|
||||
resolve: {
|
||||
userResolve: ['$stateParams', 'Admin', function ($stateParams, Admin) {
|
||||
return Admin.get({
|
||||
userId: $stateParams.userId
|
||||
});
|
||||
}]
|
||||
userResolve: getUser
|
||||
},
|
||||
data: {
|
||||
pageTitle: 'Edit {{ userResolve.displayName }}'
|
||||
@@ -31,16 +35,21 @@ angular.module('users.admin.routes').config(['$stateProvider',
|
||||
url: '/users/:userId/edit',
|
||||
templateUrl: 'modules/users/client/views/admin/edit-user.client.view.html',
|
||||
controller: 'UserController',
|
||||
controllerAs: 'vm',
|
||||
resolve: {
|
||||
userResolve: ['$stateParams', 'Admin', function ($stateParams, Admin) {
|
||||
return Admin.get({
|
||||
userId: $stateParams.userId
|
||||
});
|
||||
}]
|
||||
userResolve: getUser
|
||||
},
|
||||
data: {
|
||||
pageTitle: 'Edit User {{ userResolve.displayName }}'
|
||||
}
|
||||
});
|
||||
|
||||
getUser.$inject = ['$stateParams', 'AdminService'];
|
||||
|
||||
function getUser($stateParams, AdminService) {
|
||||
return AdminService.get({
|
||||
userId: $stateParams.userId
|
||||
}).$promise;
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Setting up route
|
||||
angular.module('users').config(['$stateProvider',
|
||||
function ($stateProvider) {
|
||||
// Setting up route
|
||||
angular
|
||||
.module('users.routes')
|
||||
.config(routeConfig);
|
||||
|
||||
routeConfig.$inject = ['$stateProvider'];
|
||||
|
||||
function routeConfig($stateProvider) {
|
||||
// Users state routing
|
||||
$stateProvider
|
||||
.state('settings', {
|
||||
abstract: true,
|
||||
url: '/settings',
|
||||
templateUrl: 'modules/users/client/views/settings/settings.client.view.html',
|
||||
controller: 'SettingsController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
roles: ['user', 'admin']
|
||||
}
|
||||
@@ -16,6 +24,8 @@ angular.module('users').config(['$stateProvider',
|
||||
.state('settings.profile', {
|
||||
url: '/profile',
|
||||
templateUrl: 'modules/users/client/views/settings/edit-profile.client.view.html',
|
||||
controller: 'EditProfileController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Settings'
|
||||
}
|
||||
@@ -23,6 +33,8 @@ angular.module('users').config(['$stateProvider',
|
||||
.state('settings.password', {
|
||||
url: '/password',
|
||||
templateUrl: 'modules/users/client/views/settings/change-password.client.view.html',
|
||||
controller: 'ChangePasswordController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Settings password'
|
||||
}
|
||||
@@ -30,6 +42,8 @@ angular.module('users').config(['$stateProvider',
|
||||
.state('settings.accounts', {
|
||||
url: '/accounts',
|
||||
templateUrl: 'modules/users/client/views/settings/manage-social-accounts.client.view.html',
|
||||
controller: 'SocialAccountsController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Settings accounts'
|
||||
}
|
||||
@@ -37,6 +51,8 @@ angular.module('users').config(['$stateProvider',
|
||||
.state('settings.picture', {
|
||||
url: '/picture',
|
||||
templateUrl: 'modules/users/client/views/settings/change-profile-picture.client.view.html',
|
||||
controller: 'ChangeProfilePictureController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Settings picture'
|
||||
}
|
||||
@@ -44,11 +60,15 @@ angular.module('users').config(['$stateProvider',
|
||||
.state('authentication', {
|
||||
abstract: true,
|
||||
url: '/authentication',
|
||||
templateUrl: 'modules/users/client/views/authentication/authentication.client.view.html'
|
||||
templateUrl: 'modules/users/client/views/authentication/authentication.client.view.html',
|
||||
controller: 'AuthenticationController',
|
||||
controllerAs: 'vm'
|
||||
})
|
||||
.state('authentication.signup', {
|
||||
url: '/signup',
|
||||
templateUrl: 'modules/users/client/views/authentication/signup.client.view.html',
|
||||
controller: 'AuthenticationController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Signup'
|
||||
}
|
||||
@@ -56,6 +76,8 @@ angular.module('users').config(['$stateProvider',
|
||||
.state('authentication.signin', {
|
||||
url: '/signin?err',
|
||||
templateUrl: 'modules/users/client/views/authentication/signin.client.view.html',
|
||||
controller: 'AuthenticationController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Signin'
|
||||
}
|
||||
@@ -68,6 +90,8 @@ angular.module('users').config(['$stateProvider',
|
||||
.state('password.forgot', {
|
||||
url: '/forgot',
|
||||
templateUrl: 'modules/users/client/views/password/forgot-password.client.view.html',
|
||||
controller: 'PasswordController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Password forgot'
|
||||
}
|
||||
@@ -94,9 +118,11 @@ angular.module('users').config(['$stateProvider',
|
||||
.state('password.reset.form', {
|
||||
url: '/:token',
|
||||
templateUrl: 'modules/users/client/views/password/reset-password.client.view.html',
|
||||
controller: 'PasswordController',
|
||||
controllerAs: 'vm',
|
||||
data: {
|
||||
pageTitle: 'Password reset form'
|
||||
}
|
||||
});
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,31 +1,42 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users.admin').controller('UserListController', ['$scope', '$filter', 'Admin',
|
||||
function ($scope, $filter, Admin) {
|
||||
Admin.query(function (data) {
|
||||
$scope.users = data;
|
||||
$scope.buildPager();
|
||||
angular
|
||||
.module('users.admin')
|
||||
.controller('UserListController', UserListController);
|
||||
|
||||
UserListController.$inject = ['$scope', '$filter', 'AdminService'];
|
||||
|
||||
function UserListController($scope, $filter, AdminService) {
|
||||
var vm = this;
|
||||
vm.buildPager = buildPager;
|
||||
vm.figureOutItemsToDisplay = figureOutItemsToDisplay;
|
||||
vm.pageChanged = pageChanged;
|
||||
|
||||
AdminService.query(function (data) {
|
||||
vm.users = data;
|
||||
vm.buildPager();
|
||||
});
|
||||
|
||||
$scope.buildPager = function () {
|
||||
$scope.pagedItems = [];
|
||||
$scope.itemsPerPage = 15;
|
||||
$scope.currentPage = 1;
|
||||
$scope.figureOutItemsToDisplay();
|
||||
};
|
||||
function buildPager() {
|
||||
vm.pagedItems = [];
|
||||
vm.itemsPerPage = 15;
|
||||
vm.currentPage = 1;
|
||||
vm.figureOutItemsToDisplay();
|
||||
}
|
||||
|
||||
$scope.figureOutItemsToDisplay = function () {
|
||||
$scope.filteredItems = $filter('filter')($scope.users, {
|
||||
$: $scope.search
|
||||
function figureOutItemsToDisplay() {
|
||||
vm.filteredItems = $filter('filter')(vm.users, {
|
||||
$: vm.search
|
||||
});
|
||||
$scope.filterLength = $scope.filteredItems.length;
|
||||
var begin = (($scope.currentPage - 1) * $scope.itemsPerPage);
|
||||
var end = begin + $scope.itemsPerPage;
|
||||
$scope.pagedItems = $scope.filteredItems.slice(begin, end);
|
||||
};
|
||||
vm.filterLength = vm.filteredItems.length;
|
||||
var begin = ((vm.currentPage - 1) * vm.itemsPerPage);
|
||||
var end = begin + vm.itemsPerPage;
|
||||
vm.pagedItems = vm.filteredItems.slice(begin, end);
|
||||
}
|
||||
|
||||
$scope.pageChanged = function () {
|
||||
$scope.figureOutItemsToDisplay();
|
||||
};
|
||||
function pageChanged() {
|
||||
vm.figureOutItemsToDisplay();
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,40 +1,50 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users.admin').controller('UserController', ['$scope', '$state', 'Authentication', 'userResolve',
|
||||
function ($scope, $state, Authentication, userResolve) {
|
||||
$scope.authentication = Authentication;
|
||||
$scope.user = userResolve;
|
||||
angular
|
||||
.module('users.admin')
|
||||
.controller('UserController', UserController);
|
||||
|
||||
$scope.remove = function (user) {
|
||||
UserController.$inject = ['$scope', '$state', 'Authentication', 'userResolve'];
|
||||
|
||||
function UserController($scope, $state, Authentication, user) {
|
||||
var vm = this;
|
||||
|
||||
vm.authentication = Authentication;
|
||||
vm.user = user;
|
||||
vm.remove = remove;
|
||||
vm.update = update;
|
||||
|
||||
function remove(user) {
|
||||
if (confirm('Are you sure you want to delete this user?')) {
|
||||
if (user) {
|
||||
user.$remove();
|
||||
|
||||
$scope.users.splice($scope.users.indexOf(user), 1);
|
||||
vm.users.splice(vm.users.indexOf(user), 1);
|
||||
} else {
|
||||
$scope.user.$remove(function () {
|
||||
vm.user.$remove(function () {
|
||||
$state.go('admin.users');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
$scope.update = function (isValid) {
|
||||
function update(isValid) {
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'userForm');
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.userForm');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var user = $scope.user;
|
||||
var user = vm.user;
|
||||
|
||||
user.$update(function () {
|
||||
$state.go('admin.user', {
|
||||
userId: user._id
|
||||
});
|
||||
}, function (errorResponse) {
|
||||
$scope.error = errorResponse.data.message;
|
||||
vm.error = errorResponse.data.message;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,66 +1,77 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users').controller('AuthenticationController', ['$scope', '$state', '$http', '$location', '$window', 'Authentication', 'PasswordValidator',
|
||||
function ($scope, $state, $http, $location, $window, Authentication, PasswordValidator) {
|
||||
$scope.authentication = Authentication;
|
||||
$scope.popoverMsg = PasswordValidator.getPopoverMsg();
|
||||
angular
|
||||
.module('users')
|
||||
.controller('AuthenticationController', AuthenticationController);
|
||||
|
||||
AuthenticationController.$inject = ['$scope', '$state', '$http', '$location', '$window', 'Authentication', 'PasswordValidator'];
|
||||
|
||||
function AuthenticationController($scope, $state, $http, $location, $window, Authentication, PasswordValidator) {
|
||||
var vm = this;
|
||||
|
||||
vm.authentication = Authentication;
|
||||
vm.getPopoverMsg = PasswordValidator.getPopoverMsg;
|
||||
vm.signup = signup;
|
||||
vm.signin = signin;
|
||||
vm.callOauthProvider = callOauthProvider;
|
||||
|
||||
// Get an eventual error defined in the URL query string:
|
||||
$scope.error = $location.search().err;
|
||||
vm.error = $location.search().err;
|
||||
|
||||
// If user is signed in then redirect back home
|
||||
if ($scope.authentication.user) {
|
||||
if (vm.authentication.user) {
|
||||
$location.path('/');
|
||||
}
|
||||
|
||||
$scope.signup = function (isValid) {
|
||||
$scope.error = null;
|
||||
function signup(isValid) {
|
||||
vm.error = null;
|
||||
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'userForm');
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.userForm');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$http.post('/api/auth/signup', $scope.credentials).success(function (response) {
|
||||
$http.post('/api/auth/signup', vm.credentials).success(function (response) {
|
||||
// If successful we assign the response to the global user model
|
||||
$scope.authentication.user = response;
|
||||
vm.authentication.user = response;
|
||||
|
||||
// And redirect to the previous or home page
|
||||
$state.go($state.previous.state.name || 'home', $state.previous.params);
|
||||
}).error(function (response) {
|
||||
$scope.error = response.message;
|
||||
vm.error = response.message;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$scope.signin = function (isValid) {
|
||||
$scope.error = null;
|
||||
function signin(isValid) {
|
||||
vm.error = null;
|
||||
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'userForm');
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.userForm');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$http.post('/api/auth/signin', $scope.credentials).success(function (response) {
|
||||
$http.post('/api/auth/signin', vm.credentials).success(function (response) {
|
||||
// If successful we assign the response to the global user model
|
||||
$scope.authentication.user = response;
|
||||
vm.authentication.user = response;
|
||||
|
||||
// And redirect to the previous or home page
|
||||
$state.go($state.previous.state.name || 'home', $state.previous.params);
|
||||
}).error(function (response) {
|
||||
$scope.error = response.message;
|
||||
vm.error = response.message;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// OAuth provider request
|
||||
$scope.callOauthProvider = function (url) {
|
||||
function callOauthProvider(url) {
|
||||
if ($state.previous && $state.previous.href) {
|
||||
url += '?redirect_to=' + encodeURIComponent($state.previous.href);
|
||||
}
|
||||
|
||||
// Effectively call OAuth authentication route:
|
||||
$window.location.href = url;
|
||||
};
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,50 +1,60 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users').controller('PasswordController', ['$scope', '$stateParams', '$http', '$location', 'Authentication', 'PasswordValidator',
|
||||
function ($scope, $stateParams, $http, $location, Authentication, PasswordValidator) {
|
||||
$scope.authentication = Authentication;
|
||||
$scope.popoverMsg = PasswordValidator.getPopoverMsg();
|
||||
angular
|
||||
.module('users')
|
||||
.controller('PasswordController', PasswordController);
|
||||
|
||||
PasswordController.$inject = ['$scope', '$stateParams', '$http', '$location', 'Authentication', 'PasswordValidator'];
|
||||
|
||||
function PasswordController($scope, $stateParams, $http, $location, Authentication, PasswordValidator) {
|
||||
var vm = this;
|
||||
|
||||
vm.resetUserPassword = resetUserPassword;
|
||||
vm.askForPasswordReset = askForPasswordReset;
|
||||
vm.authentication = Authentication;
|
||||
vm.getPopoverMsg = PasswordValidator.getPopoverMsg;
|
||||
|
||||
// If user is signed in then redirect back home
|
||||
if ($scope.authentication.user) {
|
||||
if (vm.authentication.user) {
|
||||
$location.path('/');
|
||||
}
|
||||
|
||||
// Submit forgotten password account id
|
||||
$scope.askForPasswordReset = function (isValid) {
|
||||
$scope.success = $scope.error = null;
|
||||
function askForPasswordReset(isValid) {
|
||||
vm.success = vm.error = null;
|
||||
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'forgotPasswordForm');
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.forgotPasswordForm');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$http.post('/api/auth/forgot', $scope.credentials).success(function (response) {
|
||||
$http.post('/api/auth/forgot', vm.credentials).success(function (response) {
|
||||
// Show user success message and clear form
|
||||
$scope.credentials = null;
|
||||
$scope.success = response.message;
|
||||
vm.credentials = null;
|
||||
vm.success = response.message;
|
||||
|
||||
}).error(function (response) {
|
||||
// Show user error message and clear form
|
||||
$scope.credentials = null;
|
||||
$scope.error = response.message;
|
||||
vm.credentials = null;
|
||||
vm.error = response.message;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// Change user password
|
||||
$scope.resetUserPassword = function (isValid) {
|
||||
$scope.success = $scope.error = null;
|
||||
function resetUserPassword(isValid) {
|
||||
vm.success = vm.error = null;
|
||||
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'resetPasswordForm');
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.resetPasswordForm');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$http.post('/api/auth/reset/' + $stateParams.token, $scope.passwordDetails).success(function (response) {
|
||||
$http.post('/api/auth/reset/' + $stateParams.token, vm.passwordDetails).success(function (response) {
|
||||
// If successful show success message and clear form
|
||||
$scope.passwordDetails = null;
|
||||
vm.passwordDetails = null;
|
||||
|
||||
// Attach user profile
|
||||
Authentication.user = response;
|
||||
@@ -52,8 +62,8 @@ angular.module('users').controller('PasswordController', ['$scope', '$stateParam
|
||||
// And redirect to the index page
|
||||
$location.path('/password/reset/success');
|
||||
}).error(function (response) {
|
||||
$scope.error = response.message;
|
||||
vm.error = response.message;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,28 +1,37 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users').controller('ChangePasswordController', ['$scope', '$http', 'Authentication', 'PasswordValidator',
|
||||
function ($scope, $http, Authentication, PasswordValidator) {
|
||||
$scope.user = Authentication.user;
|
||||
$scope.popoverMsg = PasswordValidator.getPopoverMsg();
|
||||
angular
|
||||
.module('users')
|
||||
.controller('ChangePasswordController', ChangePasswordController);
|
||||
|
||||
ChangePasswordController.$inject = ['$scope', '$http', 'Authentication', 'PasswordValidator'];
|
||||
|
||||
function ChangePasswordController($scope, $http, Authentication, PasswordValidator) {
|
||||
var vm = this;
|
||||
|
||||
vm.user = Authentication.user;
|
||||
vm.changeUserPassword = changeUserPassword;
|
||||
vm.getPopoverMsg = PasswordValidator.getPopoverMsg;
|
||||
|
||||
// Change user password
|
||||
$scope.changeUserPassword = function (isValid) {
|
||||
$scope.success = $scope.error = null;
|
||||
function changeUserPassword(isValid) {
|
||||
vm.success = vm.error = null;
|
||||
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'passwordForm');
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.passwordForm');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$http.post('/api/users/password', $scope.passwordDetails).success(function (response) {
|
||||
$http.post('/api/users/password', vm.passwordDetails).success(function (response) {
|
||||
// If successful show success message and clear form
|
||||
$scope.$broadcast('show-errors-reset', 'passwordForm');
|
||||
$scope.success = true;
|
||||
$scope.passwordDetails = null;
|
||||
$scope.$broadcast('show-errors-reset', 'vm.passwordForm');
|
||||
vm.success = true;
|
||||
vm.passwordDetails = null;
|
||||
}).error(function (response) {
|
||||
$scope.error = response.message;
|
||||
vm.error = response.message;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users').controller('ChangeProfilePictureController', ['$scope', '$timeout', '$window', 'Authentication', 'FileUploader',
|
||||
function ($scope, $timeout, $window, Authentication, FileUploader) {
|
||||
$scope.user = Authentication.user;
|
||||
$scope.imageURL = $scope.user.profileImageURL;
|
||||
angular
|
||||
.module('users')
|
||||
.controller('ChangeProfilePictureController', ChangeProfilePictureController);
|
||||
|
||||
ChangeProfilePictureController.$inject = ['$scope', '$timeout', '$window', 'Authentication', 'FileUploader'];
|
||||
|
||||
function ChangeProfilePictureController($scope, $timeout, $window, Authentication, FileUploader) {
|
||||
var vm = this;
|
||||
|
||||
vm.user = Authentication.user;
|
||||
vm.imageURL = vm.user.profileImageURL;
|
||||
vm.uploadProfilePicture = uploadProfilePicture;
|
||||
|
||||
vm.cancelUpload = cancelUpload;
|
||||
// Create file uploader instance
|
||||
$scope.uploader = new FileUploader({
|
||||
vm.uploader = new FileUploader({
|
||||
url: 'api/users/picture',
|
||||
alias: 'newProfilePicture'
|
||||
alias: 'newProfilePicture',
|
||||
onAfterAddingFile: onAfterAddingFile,
|
||||
onSuccessItem: onSuccessItem,
|
||||
onErrorItem: onErrorItem
|
||||
});
|
||||
|
||||
// Set file uploader image filter
|
||||
$scope.uploader.filters.push({
|
||||
vm.uploader.filters.push({
|
||||
name: 'imageFilter',
|
||||
fn: function (item, options) {
|
||||
var type = '|' + item.type.slice(item.type.lastIndexOf('/') + 1) + '|';
|
||||
@@ -21,53 +34,53 @@ angular.module('users').controller('ChangeProfilePictureController', ['$scope',
|
||||
});
|
||||
|
||||
// Called after the user selected a new picture file
|
||||
$scope.uploader.onAfterAddingFile = function (fileItem) {
|
||||
function onAfterAddingFile(fileItem) {
|
||||
if ($window.FileReader) {
|
||||
var fileReader = new FileReader();
|
||||
fileReader.readAsDataURL(fileItem._file);
|
||||
|
||||
fileReader.onload = function (fileReaderEvent) {
|
||||
$timeout(function () {
|
||||
$scope.imageURL = fileReaderEvent.target.result;
|
||||
vm.imageURL = fileReaderEvent.target.result;
|
||||
}, 0);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Called after the user has successfully uploaded a new picture
|
||||
$scope.uploader.onSuccessItem = function (fileItem, response, status, headers) {
|
||||
function onSuccessItem(fileItem, response, status, headers) {
|
||||
// Show success message
|
||||
$scope.success = true;
|
||||
vm.success = true;
|
||||
|
||||
// Populate user object
|
||||
$scope.user = Authentication.user = response;
|
||||
vm.user = Authentication.user = response;
|
||||
|
||||
// Clear upload buttons
|
||||
$scope.cancelUpload();
|
||||
};
|
||||
cancelUpload();
|
||||
}
|
||||
|
||||
// Called after the user has failed to uploaded a new picture
|
||||
$scope.uploader.onErrorItem = function (fileItem, response, status, headers) {
|
||||
function onErrorItem(fileItem, response, status, headers) {
|
||||
// Clear upload buttons
|
||||
$scope.cancelUpload();
|
||||
cancelUpload();
|
||||
|
||||
// Show error message
|
||||
$scope.error = response.message;
|
||||
};
|
||||
vm.error = response.message;
|
||||
}
|
||||
|
||||
// Change user profile picture
|
||||
$scope.uploadProfilePicture = function () {
|
||||
function uploadProfilePicture() {
|
||||
// Clear messages
|
||||
$scope.success = $scope.error = null;
|
||||
vm.success = vm.error = null;
|
||||
|
||||
// Start upload
|
||||
$scope.uploader.uploadAll();
|
||||
};
|
||||
vm.uploader.uploadAll();
|
||||
}
|
||||
|
||||
// Cancel the upload process
|
||||
$scope.cancelUpload = function () {
|
||||
$scope.uploader.clearQueue();
|
||||
$scope.imageURL = $scope.user.profileImageURL;
|
||||
};
|
||||
function cancelUpload() {
|
||||
vm.uploader.clearQueue();
|
||||
vm.imageURL = vm.user.profileImageURL;
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,29 +1,38 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users').controller('EditProfileController', ['$scope', '$http', '$location', 'Users', 'Authentication',
|
||||
function ($scope, $http, $location, Users, Authentication) {
|
||||
$scope.user = Authentication.user;
|
||||
angular
|
||||
.module('users')
|
||||
.controller('EditProfileController', EditProfileController);
|
||||
|
||||
EditProfileController.$inject = ['$scope', '$http', '$location', 'Users', 'Authentication'];
|
||||
|
||||
function EditProfileController($scope, $http, $location, Users, Authentication) {
|
||||
var vm = this;
|
||||
|
||||
vm.user = Authentication.user;
|
||||
vm.updateUserProfile = updateUserProfile;
|
||||
|
||||
// Update a user profile
|
||||
$scope.updateUserProfile = function (isValid) {
|
||||
$scope.success = $scope.error = null;
|
||||
function updateUserProfile(isValid) {
|
||||
vm.success = vm.error = null;
|
||||
|
||||
if (!isValid) {
|
||||
$scope.$broadcast('show-errors-check-validity', 'userForm');
|
||||
$scope.$broadcast('show-errors-check-validity', 'vm.userForm');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var user = new Users($scope.user);
|
||||
var user = new Users(vm.user);
|
||||
|
||||
user.$update(function (response) {
|
||||
$scope.$broadcast('show-errors-reset', 'userForm');
|
||||
$scope.$broadcast('show-errors-reset', 'vm.userForm');
|
||||
|
||||
$scope.success = true;
|
||||
vm.success = true;
|
||||
Authentication.user = response;
|
||||
}, function (response) {
|
||||
$scope.error = response.data.message;
|
||||
vm.error = response.data.message;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,26 +1,37 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users').controller('SocialAccountsController', ['$scope', '$http', 'Authentication',
|
||||
function ($scope, $http, Authentication) {
|
||||
$scope.user = Authentication.user;
|
||||
angular
|
||||
.module('users')
|
||||
.controller('SocialAccountsController', SocialAccountsController);
|
||||
|
||||
SocialAccountsController.$inject = ['$scope', '$http', 'Authentication'];
|
||||
|
||||
function SocialAccountsController($scope, $http, Authentication) {
|
||||
var vm = this;
|
||||
|
||||
vm.user = Authentication.user;
|
||||
vm.hasConnectedAdditionalSocialAccounts = hasConnectedAdditionalSocialAccounts;
|
||||
vm.isConnectedSocialAccount = isConnectedSocialAccount;
|
||||
vm.removeUserSocialAccount = removeUserSocialAccount;
|
||||
|
||||
// Check if there are additional accounts
|
||||
$scope.hasConnectedAdditionalSocialAccounts = function (provider) {
|
||||
for (var i in $scope.user.additionalProvidersData) {
|
||||
function hasConnectedAdditionalSocialAccounts(provider) {
|
||||
for (var i in vm.user.additionalProvidersData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
// Check if provider is already in use with current user
|
||||
$scope.isConnectedSocialAccount = function (provider) {
|
||||
return $scope.user.provider === provider || ($scope.user.additionalProvidersData && $scope.user.additionalProvidersData[provider]);
|
||||
};
|
||||
function isConnectedSocialAccount(provider) {
|
||||
return vm.user.provider === provider || (vm.user.additionalProvidersData && vm.user.additionalProvidersData[provider]);
|
||||
}
|
||||
|
||||
// Remove a user social account
|
||||
$scope.removeUserSocialAccount = function (provider) {
|
||||
$scope.success = $scope.error = null;
|
||||
function removeUserSocialAccount(provider) {
|
||||
vm.success = vm.error = null;
|
||||
|
||||
$http.delete('/api/users/accounts', {
|
||||
params: {
|
||||
@@ -28,11 +39,11 @@ angular.module('users').controller('SocialAccountsController', ['$scope', '$http
|
||||
}
|
||||
}).success(function (response) {
|
||||
// If successful show success message and clear form
|
||||
$scope.success = true;
|
||||
$scope.user = Authentication.user = response;
|
||||
vm.success = true;
|
||||
vm.user = Authentication.user = response;
|
||||
}).error(function (response) {
|
||||
$scope.error = response.message;
|
||||
vm.error = response.message;
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users').controller('SettingsController', ['$scope', 'Authentication',
|
||||
function ($scope, Authentication) {
|
||||
$scope.user = Authentication.user;
|
||||
angular
|
||||
.module('users')
|
||||
.controller('SettingsController', SettingsController);
|
||||
|
||||
SettingsController.$inject = ['$scope', 'Authentication'];
|
||||
|
||||
function SettingsController($scope, Authentication) {
|
||||
var vm = this;
|
||||
|
||||
vm.user = Authentication.user;
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,44 +1,64 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users')
|
||||
.directive('passwordValidator', ['PasswordValidator', function(PasswordValidator) {
|
||||
return {
|
||||
angular
|
||||
.module('users')
|
||||
.directive('passwordValidator', passwordValidator);
|
||||
|
||||
passwordValidator.$inject = ['PasswordValidator'];
|
||||
|
||||
function passwordValidator(PasswordValidator) {
|
||||
var directive = {
|
||||
require: 'ngModel',
|
||||
link: function(scope, element, attrs, ngModel) {
|
||||
ngModel.$validators.requirements = function (password) {
|
||||
var status = true;
|
||||
if (password) {
|
||||
var result = PasswordValidator.getResult(password);
|
||||
var requirementsIdx = 0;
|
||||
|
||||
// Requirements Meter - visual indicator for users
|
||||
var requirementsMeter = [
|
||||
{ color: 'danger', progress: '20' },
|
||||
{ color: 'warning', progress: '40' },
|
||||
{ color: 'info', progress: '60' },
|
||||
{ color: 'primary', progress: '80' },
|
||||
{ color: 'success', progress: '100' }
|
||||
];
|
||||
|
||||
if (result.errors.length < requirementsMeter.length) {
|
||||
requirementsIdx = requirementsMeter.length - result.errors.length - 1;
|
||||
}
|
||||
|
||||
scope.requirementsColor = requirementsMeter[requirementsIdx].color;
|
||||
scope.requirementsProgress = requirementsMeter[requirementsIdx].progress;
|
||||
|
||||
if (result.errors.length) {
|
||||
scope.popoverMsg = PasswordValidator.getPopoverMsg();
|
||||
scope.passwordErrors = result.errors;
|
||||
status = false;
|
||||
} else {
|
||||
scope.popoverMsg = '';
|
||||
scope.passwordErrors = [];
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
};
|
||||
}
|
||||
link: link
|
||||
};
|
||||
}]);
|
||||
|
||||
return directive;
|
||||
|
||||
function link(scope, element, attrs, ngModel) {
|
||||
ngModel.$validators.requirements = function (password) {
|
||||
var status = true;
|
||||
if (password) {
|
||||
var result = PasswordValidator.getResult(password);
|
||||
var requirementsIdx = 0;
|
||||
|
||||
// Requirements Meter - visual indicator for users
|
||||
var requirementsMeter = [{
|
||||
color: 'danger',
|
||||
progress: '20'
|
||||
}, {
|
||||
color: 'warning',
|
||||
progress: '40'
|
||||
}, {
|
||||
color: 'info',
|
||||
progress: '60'
|
||||
}, {
|
||||
color: 'primary',
|
||||
progress: '80'
|
||||
}, {
|
||||
color: 'success',
|
||||
progress: '100'
|
||||
}];
|
||||
|
||||
if (result.errors.length < requirementsMeter.length) {
|
||||
requirementsIdx = requirementsMeter.length - result.errors.length - 1;
|
||||
}
|
||||
|
||||
scope.requirementsColor = requirementsMeter[requirementsIdx].color;
|
||||
scope.requirementsProgress = requirementsMeter[requirementsIdx].progress;
|
||||
|
||||
if (result.errors.length) {
|
||||
scope.getPopoverMsg = PasswordValidator.getPopoverMsg();
|
||||
scope.passwordErrors = result.errors;
|
||||
status = false;
|
||||
} else {
|
||||
scope.getPopoverMsg = '';
|
||||
scope.passwordErrors = [];
|
||||
status = true;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
};
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,28 +1,37 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('users')
|
||||
.directive('passwordVerify', [function() {
|
||||
return {
|
||||
angular
|
||||
.module('users')
|
||||
.directive('passwordVerify', passwordVerify);
|
||||
|
||||
function passwordVerify() {
|
||||
var directive = {
|
||||
require: 'ngModel',
|
||||
scope: {
|
||||
passwordVerify: '='
|
||||
},
|
||||
link: function(scope, element, attrs, ngModel) {
|
||||
var status = true;
|
||||
scope.$watch(function() {
|
||||
var combined;
|
||||
if (scope.passwordVerify || ngModel) {
|
||||
combined = scope.passwordVerify + '_' + ngModel;
|
||||
}
|
||||
return combined;
|
||||
}, function(value) {
|
||||
if (value) {
|
||||
ngModel.$validators.passwordVerify = function (password) {
|
||||
var origin = scope.passwordVerify;
|
||||
return (origin !== password) ? false : true;
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
link: link
|
||||
};
|
||||
}]);
|
||||
|
||||
return directive;
|
||||
|
||||
function link(scope, element, attrs, ngModel) {
|
||||
var status = true;
|
||||
scope.$watch(function () {
|
||||
var combined;
|
||||
if (scope.passwordVerify || ngModel) {
|
||||
combined = scope.passwordVerify + '_' + ngModel;
|
||||
}
|
||||
return combined;
|
||||
}, function (value) {
|
||||
if (value) {
|
||||
ngModel.$validators.passwordVerify = function (password) {
|
||||
var origin = scope.passwordVerify;
|
||||
return (origin !== password) ? false : true;
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Users directive used to force lowercase input
|
||||
angular.module('users').directive('lowercase', function () {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
link: function (scope, element, attrs, modelCtrl) {
|
||||
// Users directive used to force lowercase input
|
||||
angular
|
||||
.module('users')
|
||||
.directive('lowercase', lowercase);
|
||||
|
||||
function lowercase() {
|
||||
var directive = {
|
||||
require: 'ngModel',
|
||||
link: link
|
||||
};
|
||||
|
||||
return directive;
|
||||
|
||||
function link(scope, element, attrs, modelCtrl) {
|
||||
modelCtrl.$parsers.push(function (input) {
|
||||
return input ? input.toLowerCase() : '';
|
||||
});
|
||||
element.css('text-transform', 'lowercase');
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Authentication service for user variables
|
||||
angular.module('users').factory('Authentication', ['$window',
|
||||
function ($window) {
|
||||
// Authentication service for user variables
|
||||
|
||||
angular
|
||||
.module('users.services')
|
||||
.factory('Authentication', Authentication);
|
||||
|
||||
Authentication.$inject = ['$window'];
|
||||
|
||||
function Authentication($window) {
|
||||
var auth = {
|
||||
user: $window.user
|
||||
};
|
||||
|
||||
return auth;
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,19 +1,33 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// PasswordValidator service used for testing the password strength
|
||||
angular.module('users').factory('PasswordValidator', ['$window',
|
||||
function ($window) {
|
||||
// PasswordValidator service used for testing the password strength
|
||||
angular
|
||||
.module('users.services')
|
||||
.factory('PasswordValidator', PasswordValidator);
|
||||
|
||||
PasswordValidator.$inject = ['$window'];
|
||||
|
||||
function PasswordValidator($window) {
|
||||
var owaspPasswordStrengthTest = $window.owaspPasswordStrengthTest;
|
||||
|
||||
return {
|
||||
getResult: function (password) {
|
||||
var result = owaspPasswordStrengthTest.test(password);
|
||||
return result;
|
||||
},
|
||||
getPopoverMsg: function () {
|
||||
var popoverMsg = 'Please enter a passphrase or password with 10 or more characters, numbers, lowercase, uppercase, and special characters.';
|
||||
return popoverMsg;
|
||||
}
|
||||
var service = {
|
||||
getResult: getResult,
|
||||
getPopoverMsg: getPopoverMsg
|
||||
};
|
||||
|
||||
return service;
|
||||
|
||||
function getResult(password) {
|
||||
var result = owaspPasswordStrengthTest.test(password);
|
||||
return result;
|
||||
}
|
||||
|
||||
function getPopoverMsg() {
|
||||
var popoverMsg = 'Please enter a passphrase or password with 10 or more characters, numbers, lowercase, uppercase, and special characters.';
|
||||
|
||||
return popoverMsg;
|
||||
}
|
||||
}
|
||||
]);
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
'use strict';
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// Users service used for communicating with the users REST endpoint
|
||||
angular.module('users').factory('Users', ['$resource',
|
||||
function ($resource) {
|
||||
// Users service used for communicating with the users REST endpoint
|
||||
angular
|
||||
.module('users.services')
|
||||
.factory('UsersService', UsersService);
|
||||
|
||||
UsersService.$inject = ['$resource'];
|
||||
|
||||
function UsersService($resource) {
|
||||
return $resource('api/users', {}, {
|
||||
update: {
|
||||
method: 'PUT'
|
||||
}
|
||||
});
|
||||
}
|
||||
]);
|
||||
|
||||
//TODO this should be Users service
|
||||
angular.module('users.admin').factory('Admin', ['$resource',
|
||||
function ($resource) {
|
||||
|
||||
//TODO this should be Users service
|
||||
angular
|
||||
.module('users.admin.services')
|
||||
.factory('AdminService', AdminService);
|
||||
|
||||
AdminService.$inject = ['$resource'];
|
||||
|
||||
function AdminService($resource) {
|
||||
return $resource('api/users/:userId', {
|
||||
userId: '@_id'
|
||||
}, {
|
||||
@@ -22,4 +33,4 @@ angular.module('users.admin').factory('Admin', ['$resource',
|
||||
}
|
||||
});
|
||||
}
|
||||
]);
|
||||
})();
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
'use strict';
|
||||
(function (app) {
|
||||
'use strict';
|
||||
|
||||
// Use Application configuration module to register a new module
|
||||
ApplicationConfiguration.registerModule('users', ['core']);
|
||||
ApplicationConfiguration.registerModule('users.admin', ['core.admin']);
|
||||
ApplicationConfiguration.registerModule('users.admin.routes', ['core.admin.routes']);
|
||||
app.registerModule('users');
|
||||
app.registerModule('users.admin');
|
||||
app.registerModule('users.services');
|
||||
app.registerModule('users.admin.services');
|
||||
app.registerModule('users.routes', ['ui.router']);
|
||||
app.registerModule('users.admin.routes', ['ui.router', 'users.admin.services']);
|
||||
})(ApplicationConfiguration);
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<section>
|
||||
<div class="page-header">
|
||||
<h1>User <span ng-bind="user.username"></span></h1>
|
||||
<h1>User <span ng-bind="vm.user.username"></span></h1>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<form name="userForm" ng-submit="update(userForm.$valid)" novalidate>
|
||||
<form name="vm.userForm" ng-submit="vm.update(vm.userForm.$valid)" novalidate>
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="firstName">First Name</label>
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="user.firstName" placeholder="First Name" required />
|
||||
<div ng-messages="userForm.firstName.$error" role="alert">
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="vm.user.firstName" placeholder="First Name" required />
|
||||
<div ng-messages="vm.userForm.firstName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">First name is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="lastName">Last Name</label>
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="user.lastName" placeholder="Last Name" required />
|
||||
<div ng-messages="userForm.lastName.$error" role="alert">
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="vm.user.lastName" placeholder="Last Name" required />
|
||||
<div ng-messages="vm.userForm.lastName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Last name is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label class="control-label" for="roles">Roles</label>
|
||||
<div class="controls">
|
||||
<input class="form-control" type="text" name="roles" ng-model="user.roles" id="roles" ng-list required />
|
||||
<div ng-messages="userForm.roles.$error" role="alert">
|
||||
<input class="form-control" type="text" name="roles" ng-model="vm.user.roles" id="roles" ng-list required />
|
||||
<div ng-messages="vm.userForm.roles.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">At least one role is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,8 +31,8 @@
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Update" class="btn btn-default">
|
||||
</div>
|
||||
<div ng-show="error" class="text-danger">
|
||||
<strong ng-bind="error"></strong>
|
||||
<div ng-show="vm.error" class="text-danger">
|
||||
<strong ng-bind="vm.error"></strong>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -5,17 +5,17 @@
|
||||
<h1>Users</h1>
|
||||
</div>
|
||||
<div class="col-md-4" style="margin-top: 2em">
|
||||
<input class="form-control col-md-4" type="text" ng-model="search" placeholder="Search" ng-change="figureOutItemsToDisplay()" />
|
||||
<input class="form-control col-md-4" type="text" ng-model="vm.search" placeholder="Search" ng-change="vm.figureOutItemsToDisplay()" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-group">
|
||||
<a ng-repeat="user in pagedItems" ui-sref="admin.user({userId: user._id})" class="list-group-item">
|
||||
<a ng-repeat="user in vm.pagedItems" ui-sref="admin.user({userId: user._id})" class="list-group-item">
|
||||
<h4 class="list-group-item-heading" ng-bind="user.username"></h4>
|
||||
<p class="list-group-item-text pull-right small" ng-bind="user.roles"></p>
|
||||
<p class="list-group-item-text" ng-bind="user.email"></p>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<uib-pagination boundary-links="true" max-size="8" items-per-page="itemsPerPage" total-items="filterLength" ng-model="currentPage" ng-change="pageChanged()"></uib-pagination>
|
||||
<uib-pagination boundary-links="true" max-size="8" items-per-page="vm.itemsPerPage" total-items="vm.filterLength" ng-model="vm.currentPage" ng-change="vm.pageChanged()"></uib-pagination>
|
||||
</section>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
<div class="page-header">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h1 ng-bind="user.username"></h1>
|
||||
<h1 ng-bind="vm.user.username"></h1>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<a class="btn btn-primary" ui-sref="admin.user-edit({userId: user._id})">
|
||||
<a class="btn btn-primary" ui-sref="admin.user-edit({userId: vm.user._id})">
|
||||
<i class="glyphicon glyphicon-edit"></i>
|
||||
</a>
|
||||
<a class="btn btn-primary" ng-click="remove();" ng-if="user._id !== authentication.user._id">
|
||||
<a class="btn btn-primary" ng-click="vm.remove()" ng-if="vm.user._id !== vm.authentication.user._id">
|
||||
<i class="glyphicon glyphicon-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
@@ -19,32 +19,32 @@
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-3"><strong>First Name</strong></div>
|
||||
<div class="col-md-6" ng-bind="user.firstName"></div>
|
||||
<div class="col-md-6" ng-bind="vm.user.firstName"></div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-3"><strong>Last Name</strong></div>
|
||||
<div class="col-md-6" ng-bind="user.lastName"></div>
|
||||
<div class="col-md-6" ng-bind="vm.user.lastName"></div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-3"><strong>Email</strong></div>
|
||||
<div class="col-md-6" ng-bind="user.email"></div>
|
||||
<div class="col-md-6" ng-bind="vm.user.email"></div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-3"><strong>Provider</strong></div>
|
||||
<div class="col-md-6" ng-bind="user.provider"></div>
|
||||
<div class="col-md-6" ng-bind="vm.user.provider"></div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-3"><strong>Created</strong></div>
|
||||
<div class="col-md-6" ng-bind="user.created"></div>
|
||||
<div class="col-md-6" ng-bind="vm.user.created"></div>
|
||||
</div>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-3"><strong>Roles</strong></div>
|
||||
<div class="col-md-6" ng-bind="user.roles"></div>
|
||||
<div class="col-md-6" ng-bind="vm.user.roles"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<section class="row" ng-controller="AuthenticationController">
|
||||
<section class="row">
|
||||
<h3 class="col-md-12 text-center">Sign in using your social accounts</h3>
|
||||
<div class="col-md-12 text-center">
|
||||
<img ng-click="callOauthProvider('/api/auth/facebook')" ng-src="/modules/users/client/img/buttons/facebook.png">
|
||||
<img ng-click="callOauthProvider('/api/auth/twitter')" ng-src="/modules/users/client/img/buttons/twitter.png">
|
||||
<img ng-click="callOauthProvider('/api/auth/google')" ng-src="/modules/users/client/img/buttons/google.png">
|
||||
<img ng-click="callOauthProvider('/api/auth/linkedin')" ng-src="/modules/users/client/img/buttons/linkedin.png">
|
||||
<img ng-click="callOauthProvider('/api/auth/github')" ng-src="/modules/users/client/img/buttons/github.png">
|
||||
<img ng-click="callOauthProvider('/api/auth/paypal')" ng-src="/modules/users/client/img/buttons/paypal.png">
|
||||
<img ng-click="vm.callOauthProvider('/api/auth/facebook')" ng-src="/modules/users/client/img/buttons/facebook.png">
|
||||
<img ng-click="vm.callOauthProvider('/api/auth/twitter')" ng-src="/modules/users/client/img/buttons/twitter.png">
|
||||
<img ng-click="vm.callOauthProvider('/api/auth/google')" ng-src="/modules/users/client/img/buttons/google.png">
|
||||
<img ng-click="vm.callOauthProvider('/api/auth/linkedin')" ng-src="/modules/users/client/img/buttons/linkedin.png">
|
||||
<img ng-click="vm.callOauthProvider('/api/auth/github')" ng-src="/modules/users/client/img/buttons/github.png">
|
||||
<img ng-click="vm.callOauthProvider('/api/auth/paypal')" ng-src="/modules/users/client/img/buttons/paypal.png">
|
||||
</div>
|
||||
<div ui-view></div>
|
||||
</section>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<div ng-controller="AuthenticationController">
|
||||
<div>
|
||||
<h3 class="col-md-12 text-center">Or with your account</h3>
|
||||
<div class="col-xs-offset-2 col-xs-8 col-md-offset-4 col-md-4">
|
||||
<form name="userForm" ng-submit="signin(userForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<form name="vm.userForm" ng-submit="vm.signin(vm.userForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="credentials.username" placeholder="Username" lowercase required>
|
||||
<div ng-messages="userForm.username.$error" role="alert">
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="vm.credentials.username" placeholder="Username" lowercase required>
|
||||
<div ng-messages="vm.userForm.username.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Username is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password" class="form-control" ng-model="credentials.password" placeholder="Password" required>
|
||||
<div ng-messages="userForm.password.$error" role="alert">
|
||||
<input type="password" id="password" name="password" class="form-control" ng-model="vm.credentials.password" placeholder="Password" required>
|
||||
<div ng-messages="vm.userForm.password.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Password is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -25,8 +25,8 @@
|
||||
<div class="text-center forgot-password">
|
||||
<a ui-sref="password.forgot">Forgot your password?</a>
|
||||
</div>
|
||||
<uib-alert type="danger" ng-show="error" class="text-center text-danger">
|
||||
<span ng-bind="error"></span>
|
||||
<uib-alert type="danger" ng-show="vm.error" class="text-center text-danger">
|
||||
<span ng-bind="vm.error"></span>
|
||||
</uib-alert>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
<div ng-controller="AuthenticationController">
|
||||
<div>
|
||||
<h3 class="col-md-12 text-center">Or sign up using your email</h3>
|
||||
<div class="col-xs-offset-2 col-xs-8 col-md-offset-4 col-md-4">
|
||||
<form name="userForm" ng-submit="signup(userForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<form name="vm.userForm" ng-submit="vm.signup(vm.userForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="firstName">First Name</label>
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="credentials.firstName" placeholder="First Name" required>
|
||||
<div ng-messages="userForm.firstName.$error" role="alert">
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="vm.credentials.firstName" placeholder="First Name" required>
|
||||
<div ng-messages="vm.userForm.firstName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">First name is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="lastName">Last Name</label>
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="credentials.lastName" placeholder="Last Name" required>
|
||||
<div ng-messages="userForm.lastName.$error" role="alert">
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="vm.credentials.lastName" placeholder="Last Name" required>
|
||||
<div ng-messages="vm.userForm.lastName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Last name is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="email">Email</label>
|
||||
<input type="email" id="email" name="email" class="form-control" ng-model="credentials.email" placeholder="Email" lowercase required>
|
||||
<div ng-messages="userForm.email.$error" role="alert">
|
||||
<input type="email" id="email" name="email" class="form-control" ng-model="vm.credentials.email" placeholder="Email" lowercase required>
|
||||
<div ng-messages="vm.userForm.email.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Email address is required.</p>
|
||||
<p class="help-block error-text" ng-message="email">Email address is invalid.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="credentials.username" placeholder="Username" lowercase required>
|
||||
<div ng-messages="userForm.username.$error" role="alert">
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="vm.credentials.username" placeholder="Username" lowercase required>
|
||||
<div ng-messages="vm.userForm.username.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Username is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password" class="form-control" ng-model="credentials.password" placeholder="Password" uib-popover="{{popoverMsg}}" uib-popover-trigger="focus" password-validator required>
|
||||
<div ng-messages="userForm.password.$error" role="alert">
|
||||
<input type="password" id="password" name="password" class="form-control" ng-model="vm.credentials.password" placeholder="Password" uib-popover="{{vm.getPopoverMsg()}}" uib-popover-trigger="focus" password-validator required>
|
||||
<div ng-messages="vm.userForm.password.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Password is required.</p>
|
||||
<div ng-repeat="passwordError in passwordErrors">
|
||||
<p class="help-block error-text" ng-show="userForm.password.$error.requirements">{{passwordError}}</p>
|
||||
<p class="help-block error-text" ng-show="vm.userForm.password.$error.requirements">{{passwordError}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-show="!userForm.password.$error.required">
|
||||
<div class="form-group" ng-show="!vm.userForm.password.$error.required">
|
||||
<label>Password Requirements</label>
|
||||
<uib-progressbar value="requirementsProgress" type="{{requirementsColor}}"><span style="color:white; white-space:nowrap;">{{requirementsProgress}}%</span></uib-progressbar>
|
||||
</div>
|
||||
@@ -51,8 +51,8 @@
|
||||
or
|
||||
<a ui-sref="authentication.signin" class="show-signup">Sign in</a>
|
||||
</div>
|
||||
<div ng-show="error" class="text-center text-danger">
|
||||
<strong ng-bind="error"></strong>
|
||||
<div ng-show="vm.error" class="text-center text-danger">
|
||||
<strong ng-bind="vm.error"></strong>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<section class="row" ng-controller="PasswordController">
|
||||
<section class="row">
|
||||
<h3 class="col-md-12 text-center">Restore your password</h3>
|
||||
<p class="small text-center">Enter your account username.</p>
|
||||
<div class="col-xs-offset-2 col-xs-8 col-md-offset-5 col-md-2">
|
||||
<form name="forgotPasswordForm" ng-submit="askForPasswordReset(forgotPasswordForm.$valid)" class="form-horizontal" novalidate autocomplete="off">
|
||||
<form name="vm.forgotPasswordForm" ng-submit="vm.askForPasswordReset(vm.forgotPasswordForm.$valid)" class="form-horizontal" novalidate autocomplete="off">
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="credentials.username" placeholder="Username" lowercase required>
|
||||
<div ng-messages="forgotPasswordForm.username.$error" role="alert">
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="vm.credentials.username" placeholder="Username" lowercase required>
|
||||
<div ng-messages="vm.forgotPasswordForm.username.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Enter a username.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center form-group">
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</div>
|
||||
<div ng-show="error" class="text-center text-danger">
|
||||
<strong ng-bind="error"></strong>
|
||||
<div ng-show="vm.error" class="text-center text-danger">
|
||||
<strong ng-bind="vm.error"></strong>
|
||||
</div>
|
||||
<div ng-show="success" class="text-center text-success">
|
||||
<strong ng-bind="success"></strong>
|
||||
<div ng-show="vm.success" class="text-center text-success">
|
||||
<strong ng-bind="vm.success"></strong>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<section class="row" ng-controller="PasswordController">
|
||||
<section class="row">
|
||||
<h3 class="col-md-12 text-center">Reset your password</h3>
|
||||
<div class="col-xs-offset-2 col-xs-8 col-md-offset-4 col-md-4">
|
||||
<form name="resetPasswordForm" ng-submit="resetUserPassword(resetPasswordForm.$valid)" class="signin form-horizontal" novalidate autocomplete="off">
|
||||
<form name="vm.resetPasswordForm" ng-submit="vm.resetUserPassword(vm.resetPasswordForm.$valid)" class="signin form-horizontal" novalidate autocomplete="off">
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="newPassword">New Password</label>
|
||||
<input type="password" id="newPassword" name="newPassword" class="form-control" ng-model="passwordDetails.newPassword" placeholder="New Password" autocomplete="new-password" uib-popover="{{popoverMsg}}" uib-popover-trigger="focus" uib-popover-placement="top" password-validator required>
|
||||
<div ng-messages="resetPasswordForm.newPassword.$error" role="alert">
|
||||
<input type="password" id="newPassword" name="newPassword" class="form-control" ng-model="vm.passwordDetails.newPassword" placeholder="New Password" autocomplete="new-password" uib-popover="{{vm.getPopoverMsg()}}" uib-popover-trigger="focus" uib-popover-placement="top" password-validator required>
|
||||
<div ng-messages="vm.resetPasswordForm.newPassword.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Enter a new password.</p>
|
||||
<div ng-repeat="passwordError in passwordErrors">
|
||||
<p class="help-block error-text" ng-show="resetPasswordForm.newPassword.$error.requirements">{{passwordError}}</p>
|
||||
<p class="help-block error-text" ng-show="vm.resetPasswordForm.newPassword.$error.requirements">{{passwordError}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="verifyPassword">Verify Password</label>
|
||||
<input type="password" id="verifyPassword" name="verifyPassword" class="form-control" ng-model="passwordDetails.verifyPassword" placeholder="Verify Password" password-verify="passwordDetails.newPassword" required>
|
||||
<div ng-messages="resetPasswordForm.verifyPassword.$error" role="alert">
|
||||
<input type="password" id="verifyPassword" name="verifyPassword" class="form-control" ng-model="vm.passwordDetails.verifyPassword" placeholder="Verify Password" password-verify="vm.passwordDetails.newPassword" required>
|
||||
<div ng-messages="vm.resetPasswordForm.verifyPassword.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Enter the password again to verify.</p>
|
||||
<p class="help-block error-text" ng-show=resetPasswordForm.verifyPassword.$error.passwordVerify>Passwords do not match.</p>
|
||||
<p class="help-block error-text" ng-show="vm.resetPasswordForm.verifyPassword.$error.passwordVerify">Passwords do not match.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-show="!resetPasswordForm.newPassword.$error.required">
|
||||
<div class="form-group" ng-show="!vm.resetPasswordForm.newPassword.$error.required">
|
||||
<label>Password Requirements</label>
|
||||
<uib-progressbar value="requirementsProgress" type="{{requirementsColor}}"><span style="color:white; white-space:nowrap;">{{requirementsProgress}}%</span></uib-progressbar>
|
||||
</div>
|
||||
@@ -29,10 +29,10 @@
|
||||
<button type="submit" class="btn btn-primary">Update Password</button>
|
||||
</div>
|
||||
<div ng-show="error" class="text-center text-danger">
|
||||
<strong ng-bind="error"></strong>
|
||||
<strong ng-bind="vm.error"></strong>
|
||||
</div>
|
||||
<div ng-show="success" class="text-center text-success">
|
||||
<strong ng-bind="success"></strong>
|
||||
<strong ng-bind="vm.success"></strong>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
<section class="row" ng-controller="ChangePasswordController">
|
||||
<section class="row">
|
||||
<div class="col-xs-offset-1 col-xs-10 col-md-offset-4 col-md-4">
|
||||
<form name="passwordForm" ng-submit="changeUserPassword(passwordForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<form name="vm.passwordForm" ng-submit="vm.changeUserPassword(vm.passwordForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="currentPassword">Current Password</label>
|
||||
<input type="password" id="currentPassword" name="currentPassword" class="form-control" ng-model="passwordDetails.currentPassword" placeholder="Current Password" required>
|
||||
<div ng-messages="passwordForm.currentPassword.$error" role="alert">
|
||||
<input type="password" id="currentPassword" name="currentPassword" class="form-control" ng-model="vm.passwordDetails.currentPassword" placeholder="Current Password" required>
|
||||
<div ng-messages="vm.passwordForm.currentPassword.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Your current password is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="newPassword">New Password</label>
|
||||
<input type="password" id="newPassword" name="newPassword" class="form-control" ng-model="passwordDetails.newPassword" placeholder="New Password" uib-popover="{{popoverMsg}}" uib-popover-trigger="focus" password-validator required>
|
||||
<div ng-messages="passwordForm.newPassword.$error" role="alert">
|
||||
<input type="password" id="newPassword" name="newPassword" class="form-control" ng-model="vm.passwordDetails.newPassword" placeholder="New Password" uib-popover="{{vm.getPopoverMsg()}}" uib-popover-trigger="focus" password-validator required>
|
||||
<div ng-messages="vm.passwordForm.newPassword.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Enter a new password.</p>
|
||||
<div ng-repeat="passwordError in passwordErrors">
|
||||
<p class="help-block error-text" ng-show="passwordForm.newPassword.$error.requirements">{{passwordError}}</p>
|
||||
<p class="help-block error-text" ng-show="vm.passwordForm.newPassword.$error.requirements">{{passwordError}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="verifyPassword">Verify Password</label>
|
||||
<input type="password" id="verifyPassword" name="verifyPassword" class="form-control" ng-model="passwordDetails.verifyPassword" placeholder="Verify Password" password-verify="passwordDetails.newPassword" required>
|
||||
<div ng-messages="passwordForm.verifyPassword.$error" role="alert">
|
||||
<input type="password" id="verifyPassword" name="verifyPassword" class="form-control" ng-model="vm.passwordDetails.verifyPassword" placeholder="Verify Password" password-verify="vm.passwordDetails.newPassword" required>
|
||||
<div ng-messages="vm.passwordForm.verifyPassword.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Verify your new password.</p>
|
||||
<p class="help-block error-text" ng-show=passwordForm.verifyPassword.$error.passwordVerify>Passwords do not match.</p>
|
||||
<p class="help-block error-text" ng-show="vm.passwordForm.verifyPassword.$error.passwordVerify">Passwords do not match.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-show="!passwordForm.newPassword.$error.required">
|
||||
<div class="form-group" ng-show="!vm.passwordForm.newPassword.$error.required">
|
||||
<label>Password Requirements</label>
|
||||
<uib-progressbar value="requirementsProgress" type="{{requirementsColor}}"><span style="color:white; white-space:nowrap;">{{requirementsProgress}}%</span></uib-progressbar>
|
||||
</div>
|
||||
<div class="text-center form-group">
|
||||
<button type="submit" class="btn btn-primary">Save Password</button>
|
||||
</div>
|
||||
<div ng-show="success" class="text-center text-success">
|
||||
<div ng-show="vm.success" class="text-center text-success">
|
||||
<strong>Password Changed Successfully</strong>
|
||||
</div>
|
||||
<div ng-show="error" class="text-center text-danger">
|
||||
<strong ng-bind="error"></strong>
|
||||
<div ng-show="vm.error" class="text-center text-danger">
|
||||
<strong ng-bind="vm.error"></strong>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
<section class="row" ng-controller="ChangeProfilePictureController">
|
||||
<section class="row">
|
||||
<div class="col-xs-offset-1 col-xs-10 col-md-offset-3 col-md-4">
|
||||
<form class="signin form-horizontal">
|
||||
<fieldset>
|
||||
<div class="form-group text-center">
|
||||
<img ng-src="{{imageURL}}" alt="{{user.displayName}}" class="img-thumbnail user-profile-picture">
|
||||
<img ng-src="{{vm.imageURL}}" alt="{{vm.user.displayName}}" class="img-thumbnail user-profile-picture">
|
||||
</div>
|
||||
<div class="text-center form-group" ng-hide="uploader.queue.length">
|
||||
<div class="text-center form-group" ng-hide="vm.uploader.queue.length">
|
||||
<span class="btn btn-default btn-file">
|
||||
Select Image <input type="file" nv-file-select uploader="uploader">
|
||||
Select Image <input type="file" nv-file-select uploader="vm.uploader">
|
||||
</span>
|
||||
</div>
|
||||
<div class="text-center form-group" ng-show="uploader.queue.length">
|
||||
<button class="btn btn-primary" ng-click="uploadProfilePicture();">Upload</button>
|
||||
<button class="btn btn-default" ng-click="cancelUpload();">Cancel</button>
|
||||
<div class="text-center form-group" ng-show="vm.uploader.queue.length">
|
||||
<button class="btn btn-primary" ng-click="vm.uploadProfilePicture();">Upload</button>
|
||||
<button class="btn btn-default" ng-click="vm.cancelUpload();">Cancel</button>
|
||||
</div>
|
||||
<div ng-show="success" class="text-center text-success">
|
||||
<div ng-show="vm.success" class="text-center text-success">
|
||||
<strong>Profile Picture Changed Successfully</strong>
|
||||
</div>
|
||||
<div ng-show="error" class="text-center text-danger">
|
||||
<strong ng-bind="error"></strong>
|
||||
<div ng-show="vm.error" class="text-center text-danger">
|
||||
<strong ng-bind="vm.error"></strong>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
<section class="row" ng-controller="EditProfileController">
|
||||
<section class="row">
|
||||
<div class="col-xs-offset-1 col-xs-10 col-md-offset-4 col-md-4">
|
||||
<form name="userForm" ng-submit="updateUserProfile(userForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<form name="vm.userForm" ng-submit="vm.updateUserProfile(vm.userForm.$valid)" class="signin" novalidate autocomplete="off">
|
||||
<fieldset>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="firstName">First Name</label>
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="user.firstName" placeholder="First Name" required>
|
||||
<div ng-messages="userForm.firstName.$error" role="alert">
|
||||
<input type="text" id="firstName" name="firstName" class="form-control" ng-model="vm.user.firstName" placeholder="First Name" required>
|
||||
<div ng-messages="vm.userForm.firstName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">First name is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="lastName">Last Name</label>
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="user.lastName" placeholder="Last Name" required>
|
||||
<div ng-messages="userForm.lastName.$error" role="alert">
|
||||
<input type="text" id="lastName" name="lastName" class="form-control" ng-model="vm.user.lastName" placeholder="Last Name" required>
|
||||
<div ng-messages="vm.userForm.lastName.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Last name is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="email">Email</label>
|
||||
<input type="email" id="email" name="email" class="form-control" ng-model="user.email" placeholder="Email" lowercase required>
|
||||
<div ng-messages="userForm.email.$error" role="alert">
|
||||
<input type="email" id="email" name="email" class="form-control" ng-model="vm.user.email" placeholder="Email" lowercase required>
|
||||
<div ng-messages="vm.userForm.email.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Email address is required.</p>
|
||||
<p class="help-block error-text" ng-message="email">Email address is invalid.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" show-errors>
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="user.username" placeholder="Username" lowercase required>
|
||||
<div ng-messages="userForm.username.$error" role="alert">
|
||||
<input type="text" id="username" name="username" class="form-control" ng-model="vm.user.username" placeholder="Username" lowercase required>
|
||||
<div ng-messages="vm.userForm.username.$error" role="alert">
|
||||
<p class="help-block error-text" ng-message="required">Username is required.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center form-group">
|
||||
<button type="submit" class="btn btn-primary">Save Profile</button>
|
||||
</div>
|
||||
<div ng-show="success" class="text-center text-success">
|
||||
<div ng-show="vm.success" class="text-center text-success">
|
||||
<strong>Profile Saved Successfully</strong>
|
||||
</div>
|
||||
<div ng-show="error" class="text-center text-danger">
|
||||
<strong ng-bind="error"></strong>
|
||||
<div ng-show="vm.error" class="text-center text-danger">
|
||||
<strong ng-bind="vm.error"></strong>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
<section class="row" ng-controller="SocialAccountsController">
|
||||
<h3 class="col-md-12 text-center" ng-show="hasConnectedAdditionalSocialAccounts()">Connected social accounts:</h3>
|
||||
<section class="row">
|
||||
<h3 class="col-md-12 text-center" ng-show="vm.hasConnectedAdditionalSocialAccounts()">Connected social accounts:</h3>
|
||||
<div class="col-md-12 text-center">
|
||||
<!-- If the user's provider field (primary) is a social account, show it here -->
|
||||
<div ng-hide="user.provider === 'local'" class="social-account-container">
|
||||
<img ng-src="/modules/users/client/img/buttons/{{user.provider}}.png">
|
||||
<i class="glyphicon glyphicon-check text-success user-primary-account" data-toggle="popover" title="Primary: {{user.provider}}"></i>
|
||||
<div ng-hide="vm.user.provider === 'local'" class="social-account-container">
|
||||
<img ng-src="/modules/users/client/img/buttons/{{vm.user.provider}}.png">
|
||||
<i class="glyphicon glyphicon-check text-success user-primary-account" data-toggle="popover" title="Primary: {{vm.user.provider}}"></i>
|
||||
</div>
|
||||
<div ng-repeat="(providerName, providerData) in user.additionalProvidersData" class="social-account-container">
|
||||
<div ng-repeat="(providerName, providerData) in vm.user.additionalProvidersData" class="social-account-container">
|
||||
<img ng-src="/modules/users/client/img/buttons/{{providerName}}.png">
|
||||
<a class="btn btn-danger btn-remove-account" ng-click="removeUserSocialAccount(providerName)">
|
||||
<a class="btn btn-danger btn-remove-account" ng-click="vm.removeUserSocialAccount(providerName)">
|
||||
<i class="glyphicon glyphicon-trash"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="col-md-12 text-center" ng-show="hasConnectedAdditionalSocialAccounts()">Unconnected social accounts:</h3>
|
||||
<h3 class="col-md-12 text-center" ng-show="vm.hasConnectedAdditionalSocialAccounts()">Unconnected social accounts:</h3>
|
||||
<div class="col-md-12 text-center">
|
||||
<div class="social-account-container" ng-hide="isConnectedSocialAccount('facebook')">
|
||||
<div class="social-account-container" ng-hide="vm.isConnectedSocialAccount('facebook')">
|
||||
<img ng-src="/modules/users/client/img/buttons/facebook.png">
|
||||
<a class="btn btn-success btn-remove-account" href="/api/auth/facebook" target="_self">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="social-account-container" ng-hide="isConnectedSocialAccount('twitter')">
|
||||
<div class="social-account-container" ng-hide="vm.isConnectedSocialAccount('twitter')">
|
||||
<img ng-src="/modules/users/client/img/buttons/twitter.png">
|
||||
<a class="btn btn-success btn-remove-account" href="/api/auth/twitter" target="_self">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="social-account-container" ng-hide="isConnectedSocialAccount('google')">
|
||||
<div class="social-account-container" ng-hide="vm.isConnectedSocialAccount('google')">
|
||||
<img ng-src="/modules/users/client/img/buttons/google.png">
|
||||
<a class="btn btn-success btn-remove-account" href="/api/auth/google" target="_self">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="social-account-container" ng-hide="isConnectedSocialAccount('linkedin')">
|
||||
<div class="social-account-container" ng-hide="vm.isConnectedSocialAccount('linkedin')">
|
||||
<img ng-src="/modules/users/client/img/buttons/linkedin.png">
|
||||
<a class="btn btn-success btn-remove-account" href="/api/auth/linkedin" target="_self">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="social-account-container" ng-hide="isConnectedSocialAccount('github')">
|
||||
<div class="social-account-container" ng-hide="vm.isConnectedSocialAccount('github')">
|
||||
<img ng-src="/modules/users/client/img/buttons/github.png">
|
||||
<a class="btn btn-success btn-remove-account" href="/api/auth/github" target="_self">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="social-account-container" ng-hide="isConnectedSocialAccount('paypal')">
|
||||
<div class="social-account-container" ng-hide="vm.isConnectedSocialAccount('paypal')">
|
||||
<img ng-src="/modules/users/client/img/buttons/paypal.png">
|
||||
<a class="btn btn-success btn-remove-account" href="/api/auth/paypal" target="_self">
|
||||
<i class="glyphicon glyphicon-plus"></i>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<section ng-controller="SettingsController">
|
||||
<section>
|
||||
<div class="page-header">
|
||||
<h1>Settings</h1>
|
||||
</div>
|
||||
@@ -11,7 +11,7 @@
|
||||
<li ui-sref-active="active">
|
||||
<a ui-sref="settings.picture">Change Profile Picture</a>
|
||||
</li>
|
||||
<li ui-sref-active="active" ng-show="user.provider === 'local'">
|
||||
<li ui-sref-active="active" ng-show="vm.user.provider === 'local'">
|
||||
<a ui-sref="settings.password">Change Password</a>
|
||||
</li>
|
||||
<li ui-sref-active="active">
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
$location = _$location_;
|
||||
|
||||
// Initialize the Authentication controller
|
||||
AuthenticationController = $controller('AuthenticationController', {
|
||||
AuthenticationController = $controller('AuthenticationController as vm', {
|
||||
$scope: scope
|
||||
});
|
||||
}));
|
||||
@@ -52,11 +52,11 @@
|
||||
// Test expected GET request
|
||||
$httpBackend.when('POST', '/api/auth/signin').respond(200, 'Fred');
|
||||
|
||||
scope.signin(true);
|
||||
scope.vm.signin(true);
|
||||
$httpBackend.flush();
|
||||
|
||||
// Test scope value
|
||||
expect(scope.authentication.user).toEqual('Fred');
|
||||
expect(scope.vm.authentication.user).toEqual('Fred');
|
||||
expect($location.url()).toEqual('/');
|
||||
});
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
// Test expected GET request
|
||||
$httpBackend.when('POST', '/api/auth/signin').respond(200, 'Fred');
|
||||
|
||||
scope.signin(true);
|
||||
scope.vm.signin(true);
|
||||
$httpBackend.flush();
|
||||
|
||||
// Test scope value
|
||||
@@ -92,43 +92,43 @@
|
||||
'message': 'Missing credentials'
|
||||
});
|
||||
|
||||
scope.signin(true);
|
||||
scope.vm.signin(true);
|
||||
$httpBackend.flush();
|
||||
|
||||
// Test scope value
|
||||
expect(scope.error).toEqual('Missing credentials');
|
||||
expect(scope.vm.error).toEqual('Missing credentials');
|
||||
});
|
||||
|
||||
it('should fail to log in with wrong credentials', function () {
|
||||
// Foo/Bar combo assumed to not exist
|
||||
scope.authentication.user = 'Foo';
|
||||
scope.credentials = 'Bar';
|
||||
scope.vm.authentication.user = 'Foo';
|
||||
scope.vm.credentials = 'Bar';
|
||||
|
||||
// Test expected POST request
|
||||
$httpBackend.expectPOST('/api/auth/signin').respond(400, {
|
||||
'message': 'Unknown user'
|
||||
});
|
||||
|
||||
scope.signin(true);
|
||||
scope.vm.signin(true);
|
||||
$httpBackend.flush();
|
||||
|
||||
// Test scope value
|
||||
expect(scope.error).toEqual('Unknown user');
|
||||
expect(scope.vm.error).toEqual('Unknown user');
|
||||
});
|
||||
});
|
||||
|
||||
describe('$scope.signup()', function () {
|
||||
it('should register with correct data', function () {
|
||||
// Test expected GET request
|
||||
scope.authentication.user = 'Fred';
|
||||
scope.vm.authentication.user = 'Fred';
|
||||
$httpBackend.when('POST', '/api/auth/signup').respond(200, 'Fred');
|
||||
|
||||
scope.signup(true);
|
||||
scope.vm.signup(true);
|
||||
$httpBackend.flush();
|
||||
|
||||
// test scope value
|
||||
expect(scope.authentication.user).toBe('Fred');
|
||||
expect(scope.error).toEqual(null);
|
||||
expect(scope.vm.authentication.user).toBe('Fred');
|
||||
expect(scope.vm.error).toEqual(null);
|
||||
expect($location.url()).toBe('/');
|
||||
});
|
||||
|
||||
@@ -138,11 +138,11 @@
|
||||
'message': 'Username already exists'
|
||||
});
|
||||
|
||||
scope.signup(true);
|
||||
scope.vm.signup(true);
|
||||
$httpBackend.flush();
|
||||
|
||||
// Test scope value
|
||||
expect(scope.error).toBe('Username already exists');
|
||||
expect(scope.vm.error).toBe('Username already exists');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -160,7 +160,7 @@
|
||||
roles: ['user']
|
||||
};
|
||||
|
||||
AuthenticationController = $controller('AuthenticationController', {
|
||||
AuthenticationController = $controller('AuthenticationController as vm', {
|
||||
$scope: scope
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
function compileDirective(template) {
|
||||
// function to compile a fresh directive with the given template, or a default one
|
||||
// input form with directive
|
||||
if (!template) template = '<input type="password" id="newPassword" name="newPassword" class="form-control" ng-model="passwordMock.newPassword" placeholder="New Password" autocomplete="new-password" uib-popover="{{popoverMsg}}" uib-popover-trigger="focus" uib-popover-placement="top" password-validator required>' +
|
||||
if (!template) template = '<input type="password" id="newPassword" name="newPassword" class="form-control" ng-model="passwordMock.newPassword" placeholder="New Password" autocomplete="new-password" uib-popover="{{getPopoverMsg}}" uib-popover-trigger="focus" uib-popover-placement="top" password-validator required>' +
|
||||
'<input type="password" id="verifyPassword" name="verifyPassword" class="form-control" ng-model="passwordMock.verifyPassword" placeholder="Verify Password" password-verify="passwordMock.newPassword" required>';
|
||||
template = '<form name="form"><div>' + template + '<input type="submit">submit form</input></div></form>';
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
};
|
||||
|
||||
// Initialize the Authentication controller
|
||||
PasswordController = $controller('PasswordController', {
|
||||
PasswordController = $controller('PasswordController as vm', {
|
||||
$scope: scope
|
||||
});
|
||||
}));
|
||||
@@ -70,7 +70,7 @@
|
||||
$window.user = null;
|
||||
|
||||
// Initialize the Authentication controller
|
||||
PasswordController = $controller('PasswordController', {
|
||||
PasswordController = $controller('PasswordController as vm', {
|
||||
$scope: scope
|
||||
});
|
||||
}));
|
||||
@@ -85,16 +85,16 @@
|
||||
password: 'P@ssw0rd!!'
|
||||
};
|
||||
beforeEach(function() {
|
||||
scope.credentials = credentials;
|
||||
scope.vm.credentials = credentials;
|
||||
});
|
||||
|
||||
it('should clear scope.success and scope.error', function() {
|
||||
scope.success = 'test';
|
||||
scope.error = 'test';
|
||||
scope.askForPasswordReset(true);
|
||||
scope.vm.success = 'test';
|
||||
scope.vm.error = 'test';
|
||||
scope.vm.askForPasswordReset(true);
|
||||
|
||||
expect(scope.success).toBeNull();
|
||||
expect(scope.error).toBeNull();
|
||||
expect(scope.vm.success).toBeNull();
|
||||
expect(scope.vm.error).toBeNull();
|
||||
});
|
||||
|
||||
describe('POST error', function() {
|
||||
@@ -104,16 +104,16 @@
|
||||
'message': errorMessage
|
||||
});
|
||||
|
||||
scope.askForPasswordReset(true);
|
||||
scope.vm.askForPasswordReset(true);
|
||||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
it('should clear form', function() {
|
||||
expect(scope.credentials).toBe(null);
|
||||
expect(scope.vm.credentials).toBe(null);
|
||||
});
|
||||
|
||||
it('should set error to response message', function() {
|
||||
expect(scope.error).toBe(errorMessage);
|
||||
expect(scope.vm.error).toBe(errorMessage);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -124,16 +124,16 @@
|
||||
'message': successMessage
|
||||
});
|
||||
|
||||
scope.askForPasswordReset(true);
|
||||
scope.vm.askForPasswordReset(true);
|
||||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
it('should clear form', function() {
|
||||
expect(scope.credentials).toBe(null);
|
||||
expect(scope.vm.credentials).toBe(null);
|
||||
});
|
||||
|
||||
it('should set success to response message', function() {
|
||||
expect(scope.success).toBe(successMessage);
|
||||
expect(scope.vm.success).toBe(successMessage);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -145,16 +145,16 @@
|
||||
};
|
||||
beforeEach(function() {
|
||||
$stateParams.token = token;
|
||||
scope.passwordDetails = passwordDetails;
|
||||
scope.vm.passwordDetails = passwordDetails;
|
||||
});
|
||||
|
||||
it('should clear scope.success and scope.error', function() {
|
||||
scope.success = 'test';
|
||||
scope.error = 'test';
|
||||
scope.resetUserPassword(true);
|
||||
it('should clear scope.success and scope.vm.error', function() {
|
||||
scope.vm.success = 'test';
|
||||
scope.vm.error = 'test';
|
||||
scope.vm.resetUserPassword(true);
|
||||
|
||||
expect(scope.success).toBeNull();
|
||||
expect(scope.error).toBeNull();
|
||||
expect(scope.vm.success).toBeNull();
|
||||
expect(scope.vm.error).toBeNull();
|
||||
});
|
||||
|
||||
it('POST error should set scope.error to response message', function() {
|
||||
@@ -163,10 +163,10 @@
|
||||
'message': errorMessage
|
||||
});
|
||||
|
||||
scope.resetUserPassword(true);
|
||||
scope.vm.resetUserPassword(true);
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(scope.error).toBe(errorMessage);
|
||||
expect(scope.vm.error).toBe(errorMessage);
|
||||
});
|
||||
|
||||
describe('POST success', function() {
|
||||
@@ -176,16 +176,16 @@
|
||||
beforeEach(function() {
|
||||
$httpBackend.when('POST', '/api/auth/reset/' + token, passwordDetails).respond(user);
|
||||
|
||||
scope.resetUserPassword(true);
|
||||
scope.vm.resetUserPassword(true);
|
||||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
it('should clear password form', function() {
|
||||
expect(scope.passwordDetails).toBe(null);
|
||||
expect(scope.vm.passwordDetails).toBe(null);
|
||||
});
|
||||
|
||||
it('should attach user profile', function() {
|
||||
expect(scope.authentication.user).toEqual(user);
|
||||
expect(scope.vm.authentication.user).toEqual(user);
|
||||
});
|
||||
|
||||
it('should redirect to password reset success view', function() {
|
||||
|
||||
@@ -28,13 +28,13 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report missing first name', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Password
|
||||
element(by.model('credentials.password')).sendKeys(user1.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// First Name Error
|
||||
@@ -44,13 +44,13 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report missing last name', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Password
|
||||
element(by.model('credentials.password')).sendKeys(user1.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Last Name Error
|
||||
@@ -60,13 +60,13 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report missing email address', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Password
|
||||
element(by.model('credentials.password')).sendKeys(user1.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Email address error
|
||||
@@ -76,15 +76,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report invalid email address - "123"', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys('123');
|
||||
element(by.model('vm.credentials.email')).sendKeys('123');
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Password
|
||||
element(by.model('credentials.password')).sendKeys(user1.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Email address error
|
||||
@@ -98,15 +98,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report invalid email address - "123@123@123"', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys('123@123@123');
|
||||
element(by.model('vm.credentials.email')).sendKeys('123@123@123');
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Password
|
||||
element(by.model('credentials.password')).sendKeys(user1.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Email address error
|
||||
@@ -116,13 +116,13 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report missing username', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Password
|
||||
element(by.model('credentials.password')).sendKeys(user1.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Username Error
|
||||
@@ -132,15 +132,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with less than 10 characters long - "P@$$w0rd!"', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Invalid Password
|
||||
element(by.model('credentials.password')).sendKeys('P@$$w0rd!');
|
||||
element(by.model('vm.credentials.password')).sendKeys('P@$$w0rd!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -150,15 +150,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with greater than 128 characters long.', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Invalid Password
|
||||
element(by.model('credentials.password')).sendKeys(')!/uLT="lh&:`6X!]|15o!$!TJf,.13l?vG].-j],lFPe/QhwN#{Z<[*1nX@n1^?WW-%_.*D)m$toB+N7z}kcN#B_d(f41h%w@0F!]igtSQ1gl~6sEV&r~}~1ub>If1c+');
|
||||
element(by.model('vm.credentials.password')).sendKeys(')!/uLT="lh&:`6X!]|15o!$!TJf,.13l?vG].-j],lFPe/QhwN#{Z<[*1nX@n1^?WW-%_.*D)m$toB+N7z}kcN#B_d(f41h%w@0F!]igtSQ1gl~6sEV&r~}~1ub>If1c+');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -168,15 +168,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with more than 3 or more repeating characters - "P@$$w0rd!!!"', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Invalid Password
|
||||
element(by.model('credentials.password')).sendKeys('P@$$w0rd!!!');
|
||||
element(by.model('vm.credentials.password')).sendKeys('P@$$w0rd!!!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -186,15 +186,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with no uppercase letters - "p@$$w0rd!!"', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Invalid Password
|
||||
element(by.model('credentials.password')).sendKeys('p@$$w0rd!!');
|
||||
element(by.model('vm.credentials.password')).sendKeys('p@$$w0rd!!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -204,15 +204,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with less than one number - "P@$$word!!"', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Invalid Password
|
||||
element(by.model('credentials.password')).sendKeys('P@$$word!!');
|
||||
element(by.model('vm.credentials.password')).sendKeys('P@$$word!!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -222,15 +222,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with less than one special character - "Passw0rdss"', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Invalid Password
|
||||
element(by.model('credentials.password')).sendKeys('Passw0rdss');
|
||||
element(by.model('vm.credentials.password')).sendKeys('Passw0rdss');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -240,15 +240,15 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should Successfully register new user', function () {
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter FirstName
|
||||
element(by.model('credentials.firstName')).sendKeys(user1.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user1.firstName);
|
||||
// Enter LastName
|
||||
element(by.model('credentials.lastName')).sendKeys(user1.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user1.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter UserName
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Password
|
||||
element(by.model('credentials.password')).sendKeys(user1.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type="submit"]')).click();
|
||||
expect(browser.getCurrentUrl()).toEqual('http://localhost:3001/');
|
||||
@@ -260,15 +260,15 @@ describe('Users E2E Tests:', function () {
|
||||
// Signup
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user2.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user2.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user2.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user2.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user1.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user1.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user2.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user2.username);
|
||||
// Enter Invalid Password
|
||||
element(by.model('credentials.password')).sendKeys(user2.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user2.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -279,15 +279,15 @@ describe('Users E2E Tests:', function () {
|
||||
// Signup
|
||||
browser.get('http://localhost:3001/authentication/signup');
|
||||
// Enter First Name
|
||||
element(by.model('credentials.firstName')).sendKeys(user2.firstName);
|
||||
element(by.model('vm.credentials.firstName')).sendKeys(user2.firstName);
|
||||
// Enter Last Name
|
||||
element(by.model('credentials.lastName')).sendKeys(user2.lastName);
|
||||
element(by.model('vm.credentials.lastName')).sendKeys(user2.lastName);
|
||||
// Enter Email
|
||||
element(by.model('credentials.email')).sendKeys(user2.email);
|
||||
element(by.model('vm.credentials.email')).sendKeys(user2.email);
|
||||
// Enter Username
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Invalid Password
|
||||
element(by.model('credentials.password')).sendKeys(user2.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user2.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -317,9 +317,9 @@ describe('Users E2E Tests:', function () {
|
||||
//Sign in
|
||||
browser.get('http://localhost:3001/authentication/signin');
|
||||
// Enter UserName
|
||||
element(by.model('credentials.username')).sendKeys(user1.username);
|
||||
element(by.model('vm.credentials.username')).sendKeys(user1.username);
|
||||
// Enter Password
|
||||
element(by.model('credentials.password')).sendKeys(user1.password);
|
||||
element(by.model('vm.credentials.password')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type="submit"]')).click();
|
||||
expect(browser.getCurrentUrl()).toEqual('http://localhost:3001/');
|
||||
@@ -342,9 +342,9 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with less than 10 characters long - "P@$$w0rd!"', function () {
|
||||
browser.get('http://localhost:3001/settings/password');
|
||||
// Enter Current Password
|
||||
element(by.model('passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
// Enter Invalid Password
|
||||
element(by.model('passwordDetails.newPassword')).sendKeys('P@$$w0rd!');
|
||||
element(by.model('vm.passwordDetails.newPassword')).sendKeys('P@$$w0rd!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -354,9 +354,9 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with greater than 128 characters long.', function () {
|
||||
browser.get('http://localhost:3001/settings/password');
|
||||
// Enter Current Password
|
||||
element(by.model('passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
// Enter Invalid Password
|
||||
element(by.model('passwordDetails.newPassword')).sendKeys(')!/uLT="lh&:`6X!]|15o!$!TJf,.13l?vG].-j],lFPe/QhwN#{Z<[*1nX@n1^?WW-%_.*D)m$toB+N7z}kcN#B_d(f41h%w@0F!]igtSQ1gl~6sEV&r~}~1ub>If1c+');
|
||||
element(by.model('vm.passwordDetails.newPassword')).sendKeys(')!/uLT="lh&:`6X!]|15o!$!TJf,.13l?vG].-j],lFPe/QhwN#{Z<[*1nX@n1^?WW-%_.*D)m$toB+N7z}kcN#B_d(f41h%w@0F!]igtSQ1gl~6sEV&r~}~1ub>If1c+');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -366,9 +366,9 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with more than 3 or more repeating characters - "P@$$w0rd!!!"', function () {
|
||||
browser.get('http://localhost:3001/settings/password');
|
||||
// Enter Current Password
|
||||
element(by.model('passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
// Enter Invalid Password
|
||||
element(by.model('passwordDetails.newPassword')).sendKeys('P@$$w0rd!!!');
|
||||
element(by.model('vm.passwordDetails.newPassword')).sendKeys('P@$$w0rd!!!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -378,9 +378,9 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with no uppercase letters - "p@$$w0rd!!"', function () {
|
||||
browser.get('http://localhost:3001/settings/password');
|
||||
// Enter Current Password
|
||||
element(by.model('passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
// Enter Invalid Password
|
||||
element(by.model('passwordDetails.newPassword')).sendKeys('p@$$w0rd!!');
|
||||
element(by.model('vm.passwordDetails.newPassword')).sendKeys('p@$$w0rd!!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -390,9 +390,9 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with less than one number - "P@$$word!!"', function () {
|
||||
browser.get('http://localhost:3001/settings/password');
|
||||
// Enter Current Password
|
||||
element(by.model('passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
// Enter Invalid Password
|
||||
element(by.model('passwordDetails.newPassword')).sendKeys('P@$$word!!');
|
||||
element(by.model('vm.passwordDetails.newPassword')).sendKeys('P@$$word!!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -402,9 +402,9 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report a password with less than one special character - "Passw0rdss"', function () {
|
||||
browser.get('http://localhost:3001/settings/password');
|
||||
// Enter Current Password
|
||||
element(by.model('passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
// Enter Invalid Password
|
||||
element(by.model('passwordDetails.newPassword')).sendKeys('Passw0rdss');
|
||||
element(by.model('vm.passwordDetails.newPassword')).sendKeys('Passw0rdss');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Error
|
||||
@@ -414,11 +414,11 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should report passwords do not match', function () {
|
||||
browser.get('http://localhost:3001/settings/password');
|
||||
// Enter Current Password
|
||||
element(by.model('passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
// Enter New Password
|
||||
element(by.model('passwordDetails.newPassword')).sendKeys('P@$$w0rds!!');
|
||||
element(by.model('vm.passwordDetails.newPassword')).sendKeys('P@$$w0rds!!');
|
||||
// Verify New Password
|
||||
element(by.model('passwordDetails.verifyPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.verifyPassword')).sendKeys(user1.password);
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Errors
|
||||
@@ -428,11 +428,11 @@ describe('Users E2E Tests:', function () {
|
||||
it('Should change the password to - "P@$$w0rds!!"', function () {
|
||||
browser.get('http://localhost:3001/settings/password');
|
||||
// Enter Current Password
|
||||
element(by.model('passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
element(by.model('vm.passwordDetails.currentPassword')).sendKeys(user1.password);
|
||||
// Enter New Password
|
||||
element(by.model('passwordDetails.newPassword')).sendKeys('P@$$w0rds!!');
|
||||
element(by.model('vm.passwordDetails.newPassword')).sendKeys('P@$$w0rds!!');
|
||||
// Verify New Password
|
||||
element(by.model('passwordDetails.verifyPassword')).sendKeys('P@$$w0rds!!');
|
||||
element(by.model('vm.passwordDetails.verifyPassword')).sendKeys('P@$$w0rds!!');
|
||||
// Click Submit button
|
||||
element(by.css('button[type=submit]')).click();
|
||||
// Password Changed
|
||||
|
||||
Reference in New Issue
Block a user