mirror of
https://github.com/moparisthebest/mail
synced 2024-11-29 20:32:15 -05:00
handle errors in new device import
This commit is contained in:
parent
b32b60e3fa
commit
54cf7557e5
@ -5,14 +5,18 @@ define(function(require) {
|
||||
appController = require('js/app-controller');
|
||||
|
||||
var LoginExistingCtrl = function($scope, $location) {
|
||||
$scope.incorrect = false;
|
||||
|
||||
$scope.confirmPassphrase = function() {
|
||||
var passphrase = $scope.passphrase,
|
||||
emailDao = appController._emailDao;
|
||||
|
||||
if (!passphrase) {
|
||||
$scope.incorrect = true;
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.incorrect = false;
|
||||
unlockCrypto(imapLogin);
|
||||
|
||||
function unlockCrypto(callback) {
|
||||
@ -30,6 +34,8 @@ define(function(require) {
|
||||
};
|
||||
emailDao.unlock(keypair, passphrase, function(err) {
|
||||
if (err) {
|
||||
$scope.incorrect = true;
|
||||
$scope.$apply();
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
@ -73,8 +79,7 @@ define(function(require) {
|
||||
return;
|
||||
}
|
||||
|
||||
reader.onload = (function(scope) {
|
||||
return function(e) {
|
||||
reader.onload = function(e) {
|
||||
var rawKeys = e.target.result,
|
||||
index = rawKeys.indexOf('-----BEGIN PGP PRIVATE KEY BLOCK-----');
|
||||
|
||||
@ -87,8 +92,8 @@ define(function(require) {
|
||||
publicKeyArmored: rawKeys.substring(0, index),
|
||||
privateKeyArmored: rawKeys.substring(index, rawKeys.length)
|
||||
};
|
||||
scope.$apply();
|
||||
};
|
||||
})(scope);
|
||||
reader.readAsText(files[0]);
|
||||
});
|
||||
};
|
||||
|
@ -7,7 +7,6 @@
|
||||
<div class="content">
|
||||
<h1>Set passphrase</h1>
|
||||
|
||||
<p>The passphrase protects your private key.</p>
|
||||
<p>If you forget your passphrase, there is no way to restore your data. So it might be a good idea to write it down and keep it in a safe place.</p>
|
||||
|
||||
<form>
|
||||
|
@ -7,11 +7,11 @@
|
||||
<div class="content">
|
||||
<h1>Import keyfile</h1>
|
||||
|
||||
<p>You are already registered on another device. To access your communication on this device, please import the encrypted key file.</p>
|
||||
<p>You are already registered on another device. To access your emails on this device, please import your key file.</p>
|
||||
|
||||
<form>
|
||||
<div><input type="file" file-reader tabindex="1"></div>
|
||||
<div><input type="password" ng-model="passphrase" placeholder="Passphrase" tabindex="2"></div>
|
||||
<div><input type="password" ng-model="passphrase" ng-class="{error:incorrect}" placeholder="Passphrase" tabindex="2"></div>
|
||||
<div><button type="submit" ng-click="confirmPassphrase()" class="btn" ng-disabled="!key" tabindex="3">Import</button>
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user