1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 19:02:20 -05:00

disable unlock button on passphrase commit

This commit is contained in:
Tankred Hase 2013-10-22 14:37:32 +02:00
parent d15af5b394
commit 1d44993d8b
2 changed files with 8 additions and 3 deletions

View File

@ -4,6 +4,7 @@ define(function(require) {
var appController = require('js/app-controller'); var appController = require('js/app-controller');
var LoginExistingCtrl = function($scope, $location) { var LoginExistingCtrl = function($scope, $location) {
$scope.buttonEnabled = true;
$scope.confirmPassphrase = function() { $scope.confirmPassphrase = function() {
var passphrase = $scope.passphrase, var passphrase = $scope.passphrase,
@ -13,6 +14,8 @@ define(function(require) {
return; return;
} }
// disable button once loggin has started
$scope.buttonEnabled = false;
unlockCrypto(imapLogin); unlockCrypto(imapLogin);
function unlockCrypto(callback) { function unlockCrypto(callback) {
@ -28,6 +31,7 @@ define(function(require) {
function imapLogin(err) { function imapLogin(err) {
if (err) { if (err) {
$scope.buttonEnabled = true;
console.error(err); console.error(err);
return; return;
} }
@ -35,6 +39,7 @@ define(function(require) {
// 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;
console.error(err); console.error(err);
return; return;
} }

View File

@ -14,7 +14,7 @@
<input type="password" ng-model="passphrase" class="passphrase" placeholder="Passphrase" tabindex="1" focus-me="true"> <input type="password" ng-model="passphrase" class="passphrase" placeholder="Passphrase" tabindex="1" focus-me="true">
</div> </div>
<div> <div>
<button type="submit" ng-click="confirmPassphrase()" class="btn" tabindex="2">Unlock</button> <button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!buttonEnabled" tabindex="2">Unlock</button>
</div> </div>
</form> </form>
</div><!--/content--> </div><!--/content-->