summaryrefslogtreecommitdiffstats
path: root/app/users
diff options
context:
space:
mode:
authorAndrew Geissler <geissonator@yahoo.com>2018-05-24 11:07:27 -0700
committerAndrew Geissler <geissonator@yahoo.com>2018-05-24 11:07:27 -0700
commitd27bb135f1561b87a174d1b9890dde2f3cf01c80 (patch)
treefee09cde2808a2319d33f65092bebecb9651dd78 /app/users
parentba5e3f3484c0de46f4f5fc5baf5804648179a9eb (diff)
downloadphosphor-webui-d27bb135f1561b87a174d1b9890dde2f3cf01c80.tar.gz
phosphor-webui-d27bb135f1561b87a174d1b9890dde2f3cf01c80.zip
Format code using clang-format-5.0
Once merged, this repository will have CI enforce the coding guidelines in the .clang-format file. Change-Id: I96a05972665f9c67625c6850c3da25edc540be06 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'app/users')
-rw-r--r--app/users/controllers/user-accounts-controller.js96
-rw-r--r--app/users/index.js39
2 files changed, 69 insertions, 66 deletions
diff --git a/app/users/controllers/user-accounts-controller.js b/app/users/controllers/user-accounts-controller.js
index 2d65d8a..868407b 100644
--- a/app/users/controllers/user-accounts-controller.js
+++ b/app/users/controllers/user-accounts-controller.js
@@ -9,53 +9,55 @@
window.angular && (function(angular) {
'use strict';
- angular
- .module('app.users')
- .controller('userAccountsController', [
- '$scope',
- '$window',
- 'APIUtils',
- 'dataService',
- function($scope, $window, APIUtils, dataService) {
- $scope.dataService = dataService;
- $scope.state = 'none';
- $scope.errorMsg = '';
+ angular.module('app.users').controller('userAccountsController', [
+ '$scope', '$window', 'APIUtils', 'dataService',
+ function($scope, $window, APIUtils, dataService) {
+ $scope.dataService = dataService;
+ $scope.state = 'none';
+ $scope.errorMsg = '';
- $scope.changePassword = function(oldPassword, newPassword, confirmNewPassword) {
- var user = $scope.dataService.getUser();
- if (!oldPassword || !newPassword || !confirmNewPassword) {
- $scope.state = 'error';
- $scope.errorMsg = 'Field is required!';
- return false;
- }
- if (newPassword !== confirmNewPassword) {
- $scope.state = 'error';
- $scope.errorMsg = 'New passwords do not match!';
- return false;
- }
- if (newPassword === oldPassword) {
- $scope.state = 'error';
- $scope.errorMsg = 'New password and old password match!';
- return false;
- }
+ $scope.changePassword = function(
+ oldPassword, newPassword, confirmNewPassword) {
+ var user = $scope.dataService.getUser();
+ if (!oldPassword || !newPassword || !confirmNewPassword) {
+ $scope.state = 'error';
+ $scope.errorMsg = 'Field is required!';
+ return false;
+ }
+ if (newPassword !== confirmNewPassword) {
+ $scope.state = 'error';
+ $scope.errorMsg = 'New passwords do not match!';
+ return false;
+ }
+ if (newPassword === oldPassword) {
+ $scope.state = 'error';
+ $scope.errorMsg = 'New password and old password match!';
+ return false;
+ }
- // Verify the oldPassword is correct
- APIUtils.testPassword(user, oldPassword).then(function(state) {
- APIUtils.changePassword(user, newPassword).then(function(response) {
- // Clear the textboxes on a success
- $scope.passwordVerify = '';
- $scope.password = '';
- $scope.oldPassword = '';
- $scope.state = 'success';
- }, function(error) {
- $scope.state = 'error';
- $scope.errorMsg = 'Error changing password!';
- });
- }, function(error) {
- $scope.state = 'error';
- $scope.errorMsg = 'Old password is not correct!';
- });
- };
- }
- ]);
+ // Verify the oldPassword is correct
+ APIUtils.testPassword(user, oldPassword)
+ .then(
+ function(state) {
+ APIUtils.changePassword(user, newPassword)
+ .then(
+ function(response) {
+ // Clear the textboxes on a success
+ $scope.passwordVerify = '';
+ $scope.password = '';
+ $scope.oldPassword = '';
+ $scope.state = 'success';
+ },
+ function(error) {
+ $scope.state = 'error';
+ $scope.errorMsg = 'Error changing password!';
+ });
+ },
+ function(error) {
+ $scope.state = 'error';
+ $scope.errorMsg = 'Old password is not correct!';
+ });
+ };
+ }
+ ]);
})(angular);
diff --git a/app/users/index.js b/app/users/index.js
index 4dfa1f2..695c294 100644
--- a/app/users/index.js
+++ b/app/users/index.js
@@ -9,24 +9,25 @@ window.angular && (function(angular) {
'use strict';
angular
- .module('app.users', [
- 'ngRoute',
- 'app.constants',
- 'app.common.services'
- ])
- // Route configuration
- .config(['$routeProvider', function($routeProvider) {
- $routeProvider
- .when('/users/manage-accounts', {
- 'template': require('./controllers/user-accounts-controller.html'),
- 'controller': 'userAccountsController',
- authenticated: true
- })
- .when('/users', {
- 'template': require('./controllers/user-accounts-controller.html'),
- 'controller': 'userAccountsController',
- authenticated: true
- });
- }]);
+ .module('app.users', ['ngRoute', 'app.constants', 'app.common.services'])
+ // Route configuration
+ .config([
+ '$routeProvider',
+ function($routeProvider) {
+ $routeProvider
+ .when('/users/manage-accounts', {
+ 'template':
+ require('./controllers/user-accounts-controller.html'),
+ 'controller': 'userAccountsController',
+ authenticated: true
+ })
+ .when('/users', {
+ 'template':
+ require('./controllers/user-accounts-controller.html'),
+ 'controller': 'userAccountsController',
+ authenticated: true
+ });
+ }
+ ]);
})(window.angular);
OpenPOWER on IntegriCloud