mirror of
https://github.com/moparisthebest/mail
synced 2025-02-07 02:20:14 -05:00
Merge pull request #353 from whiteout-io/dev/WO-891
[WO-891] Add logout to passphrase dialog
This commit is contained in:
commit
25b9141a5f
@ -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.',
|
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}',
|
connDocGenericError: 'There was an error connecting to {0}: {1}',
|
||||||
logoutTitle: 'Logout',
|
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 your account from this device?'
|
||||||
|
};
|
@ -1,8 +1,10 @@
|
|||||||
'use strict';
|
'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
|
!$routeParams.dev && !auth.isInitialized() && $location.path('/'); // init app
|
||||||
|
|
||||||
|
var str = appConfig.string;
|
||||||
|
|
||||||
$scope.confirmPassphrase = function() {
|
$scope.confirmPassphrase = function() {
|
||||||
if ($scope.form.$invalid) {
|
if ($scope.form.$invalid) {
|
||||||
$scope.errMsg = 'Please fill out all required fields!';
|
$scope.errMsg = 'Please fill out all required fields!';
|
||||||
@ -38,6 +40,18 @@ var LoginExistingCtrl = function($scope, $location, $routeParams, $q, email, aut
|
|||||||
}).catch(displayError);
|
}).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) {
|
function displayError(err) {
|
||||||
$scope.busy = false;
|
$scope.busy = false;
|
||||||
$scope.incorrect = true;
|
$scope.incorrect = true;
|
||||||
|
@ -938,8 +938,10 @@ Email.prototype.onConnect = function(imap) {
|
|||||||
Email.prototype.onDisconnect = function() {
|
Email.prototype.onDisconnect = function() {
|
||||||
// logout of imap-client
|
// logout of imap-client
|
||||||
// ignore error, because it's not problem if logout fails
|
// ignore error, because it's not problem if logout fails
|
||||||
this._imapClient.stopListeningForChanges(function() {});
|
if (this._imapClient) {
|
||||||
this._imapClient.logout(function() {});
|
this._imapClient.stopListeningForChanges(function() {});
|
||||||
|
this._imapClient.logout(function() {});
|
||||||
|
}
|
||||||
|
|
||||||
// discard clients
|
// discard clients
|
||||||
this._account.online = false;
|
this._account.online = false;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<p class="typo-paragraph">
|
<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 your passphrase?</a>
|
||||||
</p>
|
</p>
|
||||||
</main>
|
</main>
|
||||||
<div ng-include="'tpl/page-footer.html'"></div>
|
<div ng-include="'tpl/page-footer.html'"></div>
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Auth = require('../../../../src/js/service/auth'),
|
var Auth = require('../../../../src/js/service/auth'),
|
||||||
|
Account = require('../../../../src/js/email/account'),
|
||||||
|
Dialog = require('../../../../src/js/util/dialog'),
|
||||||
LoginExistingCtrl = require('../../../../src/js/controller/login/login-existing'),
|
LoginExistingCtrl = require('../../../../src/js/controller/login/login-existing'),
|
||||||
EmailDAO = require('../../../../src/js/email/email'),
|
EmailDAO = require('../../../../src/js/email/email'),
|
||||||
KeychainDAO = require('../../../../src/js/service/keychain');
|
KeychainDAO = require('../../../../src/js/service/keychain');
|
||||||
|
|
||||||
describe('Login (existing user) Controller unit test', function() {
|
describe('Login (existing user) Controller unit test', function() {
|
||||||
var scope, location, ctrl, emailDaoMock, authMock,
|
var scope, location, ctrl, emailDaoMock, authMock, accountMock, dialogMock,
|
||||||
emailAddress = 'fred@foo.com',
|
emailAddress = 'fred@foo.com',
|
||||||
passphrase = 'asd',
|
passphrase = 'asd',
|
||||||
keychainMock;
|
keychainMock;
|
||||||
@ -15,6 +17,8 @@ describe('Login (existing user) Controller unit test', function() {
|
|||||||
emailDaoMock = sinon.createStubInstance(EmailDAO);
|
emailDaoMock = sinon.createStubInstance(EmailDAO);
|
||||||
authMock = sinon.createStubInstance(Auth);
|
authMock = sinon.createStubInstance(Auth);
|
||||||
keychainMock = sinon.createStubInstance(KeychainDAO);
|
keychainMock = sinon.createStubInstance(KeychainDAO);
|
||||||
|
accountMock = sinon.createStubInstance(Account);
|
||||||
|
dialogMock = sinon.createStubInstance(Dialog);
|
||||||
|
|
||||||
authMock.emailAddress = emailAddress;
|
authMock.emailAddress = emailAddress;
|
||||||
|
|
||||||
@ -31,7 +35,10 @@ describe('Login (existing user) Controller unit test', function() {
|
|||||||
$q: window.qMock,
|
$q: window.qMock,
|
||||||
email: emailDaoMock,
|
email: emailDaoMock,
|
||||||
auth: authMock,
|
auth: authMock,
|
||||||
keychain: keychainMock
|
keychain: keychainMock,
|
||||||
|
account: accountMock,
|
||||||
|
dialog: dialogMock,
|
||||||
|
appConfig: {}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user