diff --git a/src/js/controller/login-existing.js b/src/js/controller/login-existing.js index f5cdbf2..0a3b9b7 100644 --- a/src/js/controller/login-existing.js +++ b/src/js/controller/login-existing.js @@ -15,6 +15,23 @@ define(function(require) { $scope.buttonEnabled = true; $scope.incorrect = false; + // + // Try unlocking without passphrase + // + + unlockCrypto(function(err) { + if (err) { + return; + } + + $location.path('/desktop'); + $scope.$apply(); + }); + + // + // Unlock using passphrase + // + $scope.change = function() { $scope.incorrect = false; }; @@ -27,10 +44,10 @@ define(function(require) { // disable button once loggin has started $scope.buttonEnabled = false; $scope.incorrect = false; - unlockCrypto(); + unlockCrypto(onUnlock); }; - function unlockCrypto() { + function unlockCrypto(callback) { var userId = emailDao._account.emailAddress; appController._emailDao._keychain.getUserKeyPair(userId, function(err, keypair) { if (err) { @@ -41,7 +58,7 @@ define(function(require) { emailDao.unlock({ keypair: keypair, passphrase: $scope.passphrase - }, onUnlock); + }, callback); }); } diff --git a/src/js/controller/login-initial.js b/src/js/controller/login-initial.js index 3c9c25c..ae720d1 100644 --- a/src/js/controller/login-initial.js +++ b/src/js/controller/login-initial.js @@ -53,12 +53,13 @@ define(function(require) { return str.substring(0, 1).toLowerCase() + str.substring(1); } - if (!passphrase || passphrase.length < 10) { - $scope.passphraseMsg = 'Too short'; + if (!passphrase) { + // no rating for empty passphrase + $scope.passphraseMsg = ''; return; } - if (SAME.test(passphrase)) { + if (passphrase.length < 8 || SAME.test(passphrase)) { $scope.passphraseMsg = 'Very weak'; return; } @@ -85,14 +86,14 @@ define(function(require) { var passphrase = $scope.state.passphrase, confirmation = $scope.state.confirmation; - if (!passphrase || passphrase !== confirmation) { + if (passphrase !== confirmation) { return; } $scope.setState(states.PROCESSING); setTimeout(function() { emailDao.unlock({ - passphrase: passphrase + passphrase: (passphrase) ? passphrase : undefined }, function(err) { if (err) { $scope.setState(states.IDLE); diff --git a/src/js/controller/login-new-device.js b/src/js/controller/login-new-device.js index b1b59cc..9125dc5 100644 --- a/src/js/controller/login-new-device.js +++ b/src/js/controller/login-new-device.js @@ -17,11 +17,6 @@ define(function(require) { $scope.incorrect = false; $scope.confirmPassphrase = function() { - if (!$scope.passphrase) { - $scope.incorrect = true; - return; - } - $scope.incorrect = false; unlockCrypto(); }; diff --git a/src/js/crypto/pgp.js b/src/js/crypto/pgp.js index 5fea558..e7af821 100644 --- a/src/js/crypto/pgp.js +++ b/src/js/crypto/pgp.js @@ -119,7 +119,7 @@ define(function(require) { var pubKeyId, privKeyId, self = this; // check options - if (typeof options.passphrase !== 'string' || !options.privateKeyArmored || !options.publicKeyArmored) { + if (!options.privateKeyArmored || !options.publicKeyArmored) { callback({ errMsg: 'Importing keys failed. Not all options set!' }); diff --git a/src/tpl/login-initial.html b/src/tpl/login-initial.html index bf60e8b..18d9e6a 100644 --- a/src/tpl/login-initial.html +++ b/src/tpl/login-initial.html @@ -6,22 +6,22 @@
-

Generate PGP key. Choose a passphrase to protect your new key. If you forget it at a later time you will not be able to read past messages.

Alternatively you can also import an existing PGP key.

+

Generate PGP key. You can set a passphrase to protect your key on disk. But you will have to enter it everytime you open the app. If not just press continue.

Alternatively you can also import an existing PGP key.


- - + +
- +
-

Generating keypair. Please stand by. This can take a while...

+

Generating key. Please stand by. This can take a while...

@@ -43,9 +43,8 @@
What is this?
-

A passphrase is like a password but longer.

+

A passphrase is like a password that protects your PGP key.

If your device is lost or stolen the passphrase protects the contents of your mailbox.

-

It must be at least 10 characters long and contain one special character or digit.

You cannot change your passphrase at a later time.

\ No newline at end of file