mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-06 20:54:26 +08:00
After authing an account, close IMAP connection
This commit is contained in:
parent
87905d0145
commit
35c32a3645
2 changed files with 14 additions and 8 deletions
|
@ -148,7 +148,10 @@ module.exports = (server) => {
|
|||
db: dbStub,
|
||||
}));
|
||||
|
||||
Promise.all(connectionChecks).then(() => {
|
||||
Promise.all(connectionChecks).then((conns) => {
|
||||
for (const conn of conns) {
|
||||
if (conn) { conn.end(); }
|
||||
}
|
||||
return buildAccountWith({
|
||||
name: name,
|
||||
email: email,
|
||||
|
@ -234,15 +237,18 @@ module.exports = (server) => {
|
|||
db: {},
|
||||
}),
|
||||
])
|
||||
.then(() =>
|
||||
buildAccountWith({
|
||||
.then((conns) => {
|
||||
for (const conn of conns) {
|
||||
if (conn) { conn.end(); }
|
||||
}
|
||||
return buildAccountWith({
|
||||
name: profile.name,
|
||||
email: profile.email,
|
||||
provider: Provider.Gmail,
|
||||
settings,
|
||||
credentials,
|
||||
})
|
||||
)
|
||||
})
|
||||
.then(({account, token}) => {
|
||||
const response = account.toJSON();
|
||||
response.token = token.value;
|
||||
|
|
|
@ -46,9 +46,9 @@ class IMAPConnection extends EventEmitter {
|
|||
|
||||
connect() {
|
||||
if (!this._connectPromise) {
|
||||
this._connectPromise = this._resolveIMAPSettings().then((settings) =>
|
||||
this._buildUnderlyingConnection(settings)
|
||||
);
|
||||
this._connectPromise = this._resolveIMAPSettings()
|
||||
.then((settings) => this._buildUnderlyingConnection(settings))
|
||||
.thenReturn(this);
|
||||
}
|
||||
return this._connectPromise;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ class IMAPConnection extends EventEmitter {
|
|||
this._imap.on('update', () => this.emit('update'))
|
||||
|
||||
this._imap.once('ready', () => {
|
||||
resolve(this)
|
||||
resolve()
|
||||
});
|
||||
|
||||
this._imap.once('error', (err) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue