1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-21 08:34:59 -05:00

[WO-891] Add logout to passphrase dialog

This commit is contained in:
Felix Hammerl 2015-05-19 16:21:52 +02:00
parent 467d001483
commit 8e0dfacd51
4 changed files with 23 additions and 5 deletions

View File

@ -109,5 +109,7 @@ appCfg.string = {
connDocNoInbox: 'We could not detect an IMAP inbox folder on {0}. Please have a look at the FAQ for information on how to fix this error.',
connDocGenericError: 'There was an error connecting to {0}: {1}',
logoutTitle: 'Logout',
logoutMessage: 'Are you sure you want to log out? Please back up your encryption key before proceeding!'
logoutMessage: 'Are you sure you want to log out? Please back up your encryption key before proceeding!',
removePreAuthAccountTitle: 'Remove account',
removePreAuthAccountMessage: 'Are you sure you want to remove this account from this device?'
};

View File

@ -1,8 +1,10 @@
'use strict';
var LoginExistingCtrl = function($scope, $location, $routeParams, $q, email, auth, keychain) {
var LoginExistingCtrl = function($scope, $location, $routeParams, $q, email, auth, keychain, account, dialog, appConfig) {
!$routeParams.dev && !auth.isInitialized() && $location.path('/'); // init app
var str = appConfig.string;
$scope.confirmPassphrase = function() {
if ($scope.form.$invalid) {
$scope.errMsg = 'Please fill out all required fields!';
@ -38,6 +40,18 @@ var LoginExistingCtrl = function($scope, $location, $routeParams, $q, email, aut
}).catch(displayError);
};
$scope.logout = function() {
return dialog.confirm({
title: str.removePreAuthAccountTitle,
message: str.removePreAuthAccountMessage,
callback: function(confirm) {
if (confirm) {
account.logout().catch(dialog.error);
}
}
});
};
function displayError(err) {
$scope.busy = false;
$scope.incorrect = true;

View File

@ -938,8 +938,10 @@ Email.prototype.onConnect = function(imap) {
Email.prototype.onDisconnect = function() {
// logout of imap-client
// ignore error, because it's not problem if logout fails
this._imapClient.stopListeningForChanges(function() {});
this._imapClient.logout(function() {});
if (this._imapClient) {
this._imapClient.stopListeningForChanges(function() {});
this._imapClient.logout(function() {});
}
// discard clients
this._account.online = false;

View File

@ -25,7 +25,7 @@
</div>
</form>
<p class="typo-paragraph">
<a href="https://whiteout.io/revocation.html" title="Click here to reset your account." target="_blank">Forgot your passphrase?</a>
<a href="#" wo-touch="$event.preventDefault(); logout()" title="Remove account from device">Forgot the passphrase? Remove account from device.</a>
</p>
</main>
<div ng-include="'tpl/page-footer.html'"></div>