mirror of
https://github.com/moparisthebest/mail
synced 2024-12-23 15:58:49 -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) {
|
||||
$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();
|
||||
|
@ -39,6 +39,11 @@
|
||||
border-style: solid;
|
||||
border-color: $color-grey-light;
|
||||
padding: 5px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.error {
|
||||
border: 1px solid red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
<form>
|
||||
<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>
|
||||
<button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!buttonEnabled" tabindex="2">Unlock</button>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<form>
|
||||
<div>
|
||||
<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>
|
||||
<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