From 864a47f502bcc63bf7d4939504c5babec33acc35 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Tue, 28 Apr 2015 16:08:20 -0700 Subject: [PATCH] added error messages to login flow --- server/static/scripts/controllers/users.js | 17 ++++++++++++----- server/static/scripts/drone.js | 1 + server/static/scripts/views/login.html | 9 ++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/server/static/scripts/controllers/users.js b/server/static/scripts/controllers/users.js index fc940730..20d56209 100644 --- a/server/static/scripts/controllers/users.js +++ b/server/static/scripts/controllers/users.js @@ -1,11 +1,17 @@ (function () { + function UserLoginCtrl($scope, $window) { + // attempts to extract an error message from + // the URL hash in format #error=? + $scope.error = $window.location.hash.substr(7); + } + /** * UserCtrl is responsible for managing user settings. - */ + */ function UserCtrl($scope, users, tokens) { - // Gets the currently authenticated user + // Gets the currently authenticated user users.getCurrent().then(function(payload){ $scope.user = payload.data; }); @@ -34,9 +40,9 @@ /** * UsersCtrl is responsible for managing user accounts. * This part of the site is for administrators only. - */ + */ function UsersCtrl($scope, users) { - // Gets the currently authenticated user + // Gets the currently authenticated user users.getCached().then(function(payload){ $scope.user = payload.data; }); @@ -68,6 +74,7 @@ angular .module('drone') + .controller('UserLoginCtrl', UserLoginCtrl) .controller('UserCtrl', UserCtrl) .controller('UsersCtrl', UsersCtrl); -})(); \ No newline at end of file +})(); diff --git a/server/static/scripts/drone.js b/server/static/scripts/drone.js index e139d9ba..f849dd21 100644 --- a/server/static/scripts/drone.js +++ b/server/static/scripts/drone.js @@ -55,6 +55,7 @@ }) .when('/login', { templateUrl: '/static/scripts/views/login.html', + controller: 'UserLoginCtrl' }) .when('/profile', { templateUrl: '/static/scripts/views/user.html', diff --git a/server/static/scripts/views/login.html b/server/static/scripts/views/login.html index a4ae3793..edb07a5f 100644 --- a/server/static/scripts/views/login.html +++ b/server/static/scripts/views/login.html @@ -1,3 +1,10 @@

Login

-Login \ No newline at end of file +
+
Oops. There was an unexpected error. Please try again.
+
There was an error authorizing your account.
+
Login is restricted to approved organization members only
+
Self-registration is disabled. Please contact the system admin to grant access.
+
+ +Login