mirror of
https://github.com/moparisthebest/mail
synced 2024-11-26 19:02:20 -05:00
show error on incorrect input
This commit is contained in:
parent
1d44993d8b
commit
0e08a31b21
@ -5,6 +5,7 @@ define(function(require) {
|
|||||||
|
|
||||||
var LoginExistingCtrl = function($scope, $location) {
|
var LoginExistingCtrl = function($scope, $location) {
|
||||||
$scope.buttonEnabled = true;
|
$scope.buttonEnabled = true;
|
||||||
|
$scope.incorrect = false;
|
||||||
|
|
||||||
$scope.confirmPassphrase = function() {
|
$scope.confirmPassphrase = function() {
|
||||||
var passphrase = $scope.passphrase,
|
var passphrase = $scope.passphrase,
|
||||||
@ -16,6 +17,7 @@ define(function(require) {
|
|||||||
|
|
||||||
// disable button once loggin has started
|
// disable button once loggin has started
|
||||||
$scope.buttonEnabled = false;
|
$scope.buttonEnabled = false;
|
||||||
|
$scope.incorrect = false;
|
||||||
unlockCrypto(imapLogin);
|
unlockCrypto(imapLogin);
|
||||||
|
|
||||||
function unlockCrypto(callback) {
|
function unlockCrypto(callback) {
|
||||||
@ -31,16 +33,14 @@ define(function(require) {
|
|||||||
|
|
||||||
function imapLogin(err) {
|
function imapLogin(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.buttonEnabled = true;
|
handleError(err);
|
||||||
console.error(err);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// login to imap backend
|
// login to imap backend
|
||||||
appController._emailDao.imapLogin(function(err) {
|
appController._emailDao.imapLogin(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.buttonEnabled = true;
|
handleError(err);
|
||||||
console.error(err);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onLogin();
|
onLogin();
|
||||||
@ -48,6 +48,13 @@ define(function(require) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function handleError(err) {
|
||||||
|
$scope.incorrect = true;
|
||||||
|
$scope.buttonEnabled = true;
|
||||||
|
$scope.$apply();
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
|
||||||
function onLogin() {
|
function onLogin() {
|
||||||
$location.path('/desktop');
|
$location.path('/desktop');
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-color: $color-grey-light;
|
border-color: $color-grey-light;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
border: 1px solid red;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<form>
|
<form>
|
||||||
<div>
|
<div>
|
||||||
<input type="password" ng-model="passphrase" class="passphrase" placeholder="Passphrase" tabindex="1" focus-me="true">
|
<input type="password" ng-model="passphrase" ng-class="{error:incorrect}" placeholder="Passphrase" tabindex="1" focus-me="true">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!buttonEnabled" tabindex="2">Unlock</button>
|
<button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!buttonEnabled" tabindex="2">Unlock</button>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<form>
|
<form>
|
||||||
<div>
|
<div>
|
||||||
<input type="password" ng-model="passphrase" placeholder="Enter passphrase" tabindex="1" focus-me="true">
|
<input type="password" ng-model="passphrase" placeholder="Enter passphrase" tabindex="1" focus-me="true">
|
||||||
<input type="password" ng-model="confirmation" placeholder="Confirm Passphrase" tabindex="2">
|
<input type="password" ng-model="confirmation" ng-class="{error: confirmation !== passphrase}" placeholder="Confirm Passphrase" tabindex="2">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!passphrase || passphrase!==confirmation" tabindex="3">Generate keypair</button>
|
<button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!passphrase || passphrase!==confirmation" tabindex="3">Generate keypair</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user