diff --git a/src/js/controller/login-existing.js b/src/js/controller/login-existing.js index 9acb772..82834f7 100644 --- a/src/js/controller/login-existing.js +++ b/src/js/controller/login-existing.js @@ -5,6 +5,7 @@ define(function(require) { var LoginExistingCtrl = function($scope, $location) { $scope.buttonEnabled = true; + $scope.incorrect = false; $scope.confirmPassphrase = function() { var passphrase = $scope.passphrase, @@ -16,6 +17,7 @@ define(function(require) { // disable button once loggin has started $scope.buttonEnabled = false; + $scope.incorrect = false; unlockCrypto(imapLogin); function unlockCrypto(callback) { @@ -31,16 +33,14 @@ define(function(require) { function imapLogin(err) { if (err) { - $scope.buttonEnabled = true; - console.error(err); + handleError(err); return; } // login to imap backend appController._emailDao.imapLogin(function(err) { if (err) { - $scope.buttonEnabled = true; - console.error(err); + handleError(err); return; } onLogin(); @@ -48,6 +48,13 @@ define(function(require) { } }; + function handleError(err) { + $scope.incorrect = true; + $scope.buttonEnabled = true; + $scope.$apply(); + console.error(err); + } + function onLogin() { $location.path('/desktop'); $scope.$apply(); diff --git a/src/sass/views/_login.scss b/src/sass/views/_login.scss index 2bb6b4c..e3235a7 100644 --- a/src/sass/views/_login.scss +++ b/src/sass/views/_login.scss @@ -39,6 +39,11 @@ border-style: solid; border-color: $color-grey-light; padding: 5px; + outline: none; + } + + .error { + border: 1px solid red; } } } diff --git a/src/tpl/login-existing.html b/src/tpl/login-existing.html index 101171f..409718b 100644 --- a/src/tpl/login-existing.html +++ b/src/tpl/login-existing.html @@ -11,7 +11,7 @@