Mailspring/app/internal_packages/onboarding/lib/onboarding-helpers.es6

173 lines
4.8 KiB
Plaintext
Raw Normal View History

feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
/* eslint global-require: 0 */
import crypto from 'crypto';
import {CommonProviderSettings} from 'imap-provider-settings';
import {
NylasAPIRequest,
IdentityStore,
RegExpUtils,
MailsyncProcess,
} from 'nylas-exports';
const {makeRequest, rootURLForServer} = NylasAPIRequest;
const IMAP_FIELDS = new Set([
"imap_host",
"imap_port",
"imap_username",
"imap_password",
[*] Revamp SSL options (including user-facing) Summary: Previously, the generic IMAP auth screen presented one security option to users: "Require SSL". This was ambiguous and difficult to translate into the correct security options behind the scenes, causing confusion and problems connecting some accounts. This patch does the following: * Separates security settings for IMAP and SMTP, as these different protocols may also require different SSL/TLS settings * Reworks the generic IMAP auth page to allow specifying security settings with higher fidelity. We looked at various different email apps and decided that the best solution to this problem was to allow more detailed specification of security settings and to ease the burden of more options by having sane defaults that work correctly in the majority of cases. This new screen allows users to pick from "SSL / TLS", "STARTTLS", or "none" for the security settings for a protocol, and also to instruct us that they're OK with us using known insecure SSL settings to connect to their server by checking a checkbox. We default to port 993 / SSL/TLS for IMAP and port 587 / STARTTLS for SMTP. These are the most common settings for providers these days and will work for most folks. * Significantly tightens our default security. Now that we can allow folks to opt-in to bad security, by default we should protect folks as best we can. * Removes some now-unnecessary jank like specifying the SSLv3 "cipher" in some custom SMTP configs. I don't think this was actually necessary as SSLv3 is a protocol and not a valid cipher, but these custom configs may have been necessary because of how the ssl_required flag was linked between IMAP and SMTP before (and thus to specify different settings for SMTP you'd have to override the SMTP config). * Removes hard-coding of Gmail & Office365 settings in several locations. (This was a major headache while working on the patch.) This depends on version 2.0.1 of imap-provider-settings, which has major breaking changes from version 1.0. See commit for more info: https://github.com/nylas/imap-provider-settings/commit/9851054f9153476b6896d04893a40b4febc8986e Among other things, I did a serious audit of the settings in this file and "upgraded" a few servers which weren't using the SSL-enabled ports for their provider to the secure ones. Hurray for nmap and openssl. Test Plan: manual Reviewers: evan, mark, juan, halla Reviewed By: juan, halla Differential Revision: https://phab.nylas.com/D4316
2017-04-06 08:34:13 +08:00
"imap_security",
"imap_allow_insecure_ssl",
"smtp_host",
"smtp_port",
"smtp_username",
"smtp_password",
[*] Revamp SSL options (including user-facing) Summary: Previously, the generic IMAP auth screen presented one security option to users: "Require SSL". This was ambiguous and difficult to translate into the correct security options behind the scenes, causing confusion and problems connecting some accounts. This patch does the following: * Separates security settings for IMAP and SMTP, as these different protocols may also require different SSL/TLS settings * Reworks the generic IMAP auth page to allow specifying security settings with higher fidelity. We looked at various different email apps and decided that the best solution to this problem was to allow more detailed specification of security settings and to ease the burden of more options by having sane defaults that work correctly in the majority of cases. This new screen allows users to pick from "SSL / TLS", "STARTTLS", or "none" for the security settings for a protocol, and also to instruct us that they're OK with us using known insecure SSL settings to connect to their server by checking a checkbox. We default to port 993 / SSL/TLS for IMAP and port 587 / STARTTLS for SMTP. These are the most common settings for providers these days and will work for most folks. * Significantly tightens our default security. Now that we can allow folks to opt-in to bad security, by default we should protect folks as best we can. * Removes some now-unnecessary jank like specifying the SSLv3 "cipher" in some custom SMTP configs. I don't think this was actually necessary as SSLv3 is a protocol and not a valid cipher, but these custom configs may have been necessary because of how the ssl_required flag was linked between IMAP and SMTP before (and thus to specify different settings for SMTP you'd have to override the SMTP config). * Removes hard-coding of Gmail & Office365 settings in several locations. (This was a major headache while working on the patch.) This depends on version 2.0.1 of imap-provider-settings, which has major breaking changes from version 1.0. See commit for more info: https://github.com/nylas/imap-provider-settings/commit/9851054f9153476b6896d04893a40b4febc8986e Among other things, I did a serious audit of the settings in this file and "upgraded" a few servers which weren't using the SSL-enabled ports for their provider to the secure ones. Hurray for nmap and openssl. Test Plan: manual Reviewers: evan, mark, juan, halla Reviewed By: juan, halla Differential Revision: https://phab.nylas.com/D4316
2017-04-06 08:34:13 +08:00
"smtp_security",
"smtp_allow_insecure_ssl",
]);
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
function base64url(inBuffer) {
let buffer;
if (typeof inBuffer === "string") {
buffer = new Buffer(inBuffer);
} else if (inBuffer instanceof Buffer) {
buffer = inBuffer;
} else {
throw new Error(`${inBuffer} must be a string or Buffer`)
}
return buffer.toString('base64')
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
.replace(/\+/g, '-') // Convert '+' to '-'
.replace(/\//g, '_'); // Convert '/' to '_'
}
export function makeGmailOAuthRequest(sessionKey) {
return makeRequest({
server: 'accounts',
path: `/auth/gmail/token?key=${sessionKey}`,
method: 'GET',
auth: false,
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
});
}
export async function authIMAPForGmail(serverTokenResponse) {
// At this point, the Mailspring server has retrieved the Gmail token,
// created an account object in the database and tested it. All we
// need to do is save it locally, since we're confident Gmail will be
// accessible from the local sync worker.
const {id, email_address, provider, connection_settings, account_token, xoauth_refresh_token, name} = serverTokenResponse;
// Todo: clean up the serialization so this translation from K2 JSON isn't necessary.
return {
account: {
id,
provider,
name,
emailAddress: email_address,
settings: Object.assign({}, connection_settings, {
xoauth_refresh_token,
}),
},
cloudToken: account_token,
};
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
}
export function buildGmailSessionKey() {
return base64url(crypto.randomBytes(40));
}
export function buildGmailAuthURL(sessionKey) {
return `${rootURLForServer('accounts')}/auth/gmail?state=${sessionKey}`;
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
}
export async function runAuthValidation(accountInfo) {
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
const {username, type, email, name} = accountInfo;
const data = {
id: 'temp',
provider: type,
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
name: name,
2017-07-04 14:50:37 +08:00
emailAddress: email,
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
settings: Object.assign({}, accountInfo),
};
// handle special case for exchange/outlook/hotmail username field
data.settings.username = username || email;
if (data.settings.imap_port) {
2016-10-18 08:59:33 +08:00
data.settings.imap_port /= 1;
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
}
if (data.settings.smtp_port) {
2016-10-18 08:59:33 +08:00
data.settings.smtp_port /= 1;
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
}
2017-07-04 14:50:37 +08:00
// Only include the required IMAP fields. Auth validation does not allow extra fields
if (type !== "gmail") {
for (const key of Object.keys(data.settings)) {
if (!IMAP_FIELDS.has(key)) {
delete data.settings[key];
}
}
}
// Test the account locally - if it succeeds, send it to the server and test it there
const proc = new MailsyncProcess(NylasEnv.getLoadSettings(), IdentityStore.identity(), data);
const {account} = await proc.test();
delete data.id;
const {id, account_token} = await makeRequest({
server: 'accounts',
path: `/auth`,
method: 'POST',
timeout: 1000 * 180, // Same timeout as server timeout (most requests are faster than 90s, but server validation can be slow in some cases)
body: data,
auth: false,
})
return {
account: Object.assign({}, account, {id}),
cloudToken: account_token,
};
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
}
export function isValidHost(value) {
return RegExpUtils.domainRegex().test(value) || RegExpUtils.ipAddressRegex().test(value);
}
export function expandAccountInfoWithCommonSettings(accountInfo) {
const {email, type} = accountInfo;
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
const domain = email.split('@').pop().toLowerCase();
[*] Revamp SSL options (including user-facing) Summary: Previously, the generic IMAP auth screen presented one security option to users: "Require SSL". This was ambiguous and difficult to translate into the correct security options behind the scenes, causing confusion and problems connecting some accounts. This patch does the following: * Separates security settings for IMAP and SMTP, as these different protocols may also require different SSL/TLS settings * Reworks the generic IMAP auth page to allow specifying security settings with higher fidelity. We looked at various different email apps and decided that the best solution to this problem was to allow more detailed specification of security settings and to ease the burden of more options by having sane defaults that work correctly in the majority of cases. This new screen allows users to pick from "SSL / TLS", "STARTTLS", or "none" for the security settings for a protocol, and also to instruct us that they're OK with us using known insecure SSL settings to connect to their server by checking a checkbox. We default to port 993 / SSL/TLS for IMAP and port 587 / STARTTLS for SMTP. These are the most common settings for providers these days and will work for most folks. * Significantly tightens our default security. Now that we can allow folks to opt-in to bad security, by default we should protect folks as best we can. * Removes some now-unnecessary jank like specifying the SSLv3 "cipher" in some custom SMTP configs. I don't think this was actually necessary as SSLv3 is a protocol and not a valid cipher, but these custom configs may have been necessary because of how the ssl_required flag was linked between IMAP and SMTP before (and thus to specify different settings for SMTP you'd have to override the SMTP config). * Removes hard-coding of Gmail & Office365 settings in several locations. (This was a major headache while working on the patch.) This depends on version 2.0.1 of imap-provider-settings, which has major breaking changes from version 1.0. See commit for more info: https://github.com/nylas/imap-provider-settings/commit/9851054f9153476b6896d04893a40b4febc8986e Among other things, I did a serious audit of the settings in this file and "upgraded" a few servers which weren't using the SSL-enabled ports for their provider to the secure ones. Hurray for nmap and openssl. Test Plan: manual Reviewers: evan, mark, juan, halla Reviewed By: juan, halla Differential Revision: https://phab.nylas.com/D4316
2017-04-06 08:34:13 +08:00
let template = CommonProviderSettings[domain] || CommonProviderSettings[type] || {};
if (template.alias) {
template = CommonProviderSettings[template.alias];
}
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
const usernameWithFormat = (format) => {
if (format === 'email') {
return email
}
if (format === 'email-without-domain') {
return email.split('@').shift();
}
return undefined;
}
const defaults = {
imap_host: template.imap_host,
imap_port: template.imap_port || 993,
imap_username: usernameWithFormat(template.imap_user_format),
imap_password: accountInfo.password,
[*] Revamp SSL options (including user-facing) Summary: Previously, the generic IMAP auth screen presented one security option to users: "Require SSL". This was ambiguous and difficult to translate into the correct security options behind the scenes, causing confusion and problems connecting some accounts. This patch does the following: * Separates security settings for IMAP and SMTP, as these different protocols may also require different SSL/TLS settings * Reworks the generic IMAP auth page to allow specifying security settings with higher fidelity. We looked at various different email apps and decided that the best solution to this problem was to allow more detailed specification of security settings and to ease the burden of more options by having sane defaults that work correctly in the majority of cases. This new screen allows users to pick from "SSL / TLS", "STARTTLS", or "none" for the security settings for a protocol, and also to instruct us that they're OK with us using known insecure SSL settings to connect to their server by checking a checkbox. We default to port 993 / SSL/TLS for IMAP and port 587 / STARTTLS for SMTP. These are the most common settings for providers these days and will work for most folks. * Significantly tightens our default security. Now that we can allow folks to opt-in to bad security, by default we should protect folks as best we can. * Removes some now-unnecessary jank like specifying the SSLv3 "cipher" in some custom SMTP configs. I don't think this was actually necessary as SSLv3 is a protocol and not a valid cipher, but these custom configs may have been necessary because of how the ssl_required flag was linked between IMAP and SMTP before (and thus to specify different settings for SMTP you'd have to override the SMTP config). * Removes hard-coding of Gmail & Office365 settings in several locations. (This was a major headache while working on the patch.) This depends on version 2.0.1 of imap-provider-settings, which has major breaking changes from version 1.0. See commit for more info: https://github.com/nylas/imap-provider-settings/commit/9851054f9153476b6896d04893a40b4febc8986e Among other things, I did a serious audit of the settings in this file and "upgraded" a few servers which weren't using the SSL-enabled ports for their provider to the secure ones. Hurray for nmap and openssl. Test Plan: manual Reviewers: evan, mark, juan, halla Reviewed By: juan, halla Differential Revision: https://phab.nylas.com/D4316
2017-04-06 08:34:13 +08:00
imap_security: template.imap_security || "SSL / TLS",
imap_allow_insecure_ssl: template.imap_allow_insecure_ssl || false,
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
smtp_host: template.smtp_host,
smtp_port: template.smtp_port || 587,
smtp_username: usernameWithFormat(template.smtp_user_format),
smtp_password: accountInfo.password,
[*] Revamp SSL options (including user-facing) Summary: Previously, the generic IMAP auth screen presented one security option to users: "Require SSL". This was ambiguous and difficult to translate into the correct security options behind the scenes, causing confusion and problems connecting some accounts. This patch does the following: * Separates security settings for IMAP and SMTP, as these different protocols may also require different SSL/TLS settings * Reworks the generic IMAP auth page to allow specifying security settings with higher fidelity. We looked at various different email apps and decided that the best solution to this problem was to allow more detailed specification of security settings and to ease the burden of more options by having sane defaults that work correctly in the majority of cases. This new screen allows users to pick from "SSL / TLS", "STARTTLS", or "none" for the security settings for a protocol, and also to instruct us that they're OK with us using known insecure SSL settings to connect to their server by checking a checkbox. We default to port 993 / SSL/TLS for IMAP and port 587 / STARTTLS for SMTP. These are the most common settings for providers these days and will work for most folks. * Significantly tightens our default security. Now that we can allow folks to opt-in to bad security, by default we should protect folks as best we can. * Removes some now-unnecessary jank like specifying the SSLv3 "cipher" in some custom SMTP configs. I don't think this was actually necessary as SSLv3 is a protocol and not a valid cipher, but these custom configs may have been necessary because of how the ssl_required flag was linked between IMAP and SMTP before (and thus to specify different settings for SMTP you'd have to override the SMTP config). * Removes hard-coding of Gmail & Office365 settings in several locations. (This was a major headache while working on the patch.) This depends on version 2.0.1 of imap-provider-settings, which has major breaking changes from version 1.0. See commit for more info: https://github.com/nylas/imap-provider-settings/commit/9851054f9153476b6896d04893a40b4febc8986e Among other things, I did a serious audit of the settings in this file and "upgraded" a few servers which weren't using the SSL-enabled ports for their provider to the secure ones. Hurray for nmap and openssl. Test Plan: manual Reviewers: evan, mark, juan, halla Reviewed By: juan, halla Differential Revision: https://phab.nylas.com/D4316
2017-04-06 08:34:13 +08:00
smtp_security: template.smtp_security || "STARTTLS",
smtp_allow_insecure_ssl: template.smtp_allow_insecure_ssl || false,
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
}
return Object.assign({}, accountInfo, defaults);
feat(pro): New Nylas identity provider, onboarding and auth commit 50d0cfb87cd0e3d518ee91984bfac7d0c6782418 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 14:01:49 2016 -0700 IdentityStore conveniene methods for subscription state commit 80c3c7b9564ff79b5727f6812620b9436f35f963 Author: Ben Gotow <bengotow@gmail.com> Date: Fri May 27 12:03:53 2016 -0700 Periodically refresh identity, show expired notice in top bar commit 5dc39efe9829b2e2c14e27486b3163df4157fd17 Merge: 4c4f463 906ea74 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:17:46 2016 -0700 Merge branch 'bengotow/n1-pro' of github.com:nylas/N1 into bengotow/n1-pro commit 4c4f463f4b20725bc07e5c8906ecba1de54a6bd1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Thu May 26 15:16:48 2016 -0700 Hijack links inside email that go to billing site and add SSO to them commit 906ea74807590e6324839b327ada1943814b17fd Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 26 12:02:29 2016 -0700 Add custom welcome page for upgrading users commit 2ba9aedfe97679d845262a46b70e93d8e787cec1 Author: Juan Tejada <juans.tejada@gmail.com> Date: Wed May 25 17:27:12 2016 -0700 Add styling to Subscription tab in prefs commit 384433a338a6fb90c432d2819afc3eee127dbace Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 16:21:18 2016 -0700 Add better style reset, more IdentityStore changes commit c4f9dfb4e4007ff7e785d6d5d459a58078913e7a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 15:29:41 2016 -0700 Add subscription tab commit bd4c25405a0edc30a3770ac09ee410f75006d73a Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 14:18:40 2016 -0700 Point to billing-staging for now commit 578e808bfccba22854b880c3dc51e01ac164302b Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:30:13 2016 -0700 Rename account helpers > onboarding helpers commit dfea0a98615ebdbe94a77f8a752f543bafa8411d Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 13:26:46 2016 -0700 A few minor fixes commit 7110217fd4b477557a05f2b2cde8fbbd50ced9b3 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:58:21 2016 -0700 feat(onboarding): Nylas Pro onboarding overhaul Summary: Rip out all invite-related code Enable Templates and Translate by default Scrub packages page, unused code in onboarding pkg Remove resizing New onboarding screens IMAP provider list, validation Call success with response object as well Renaming and tweaks Test Plan: No tests yet Reviewers: evan, juan, jackie Differential Revision: https://phab.nylas.com/D2985 commit dc9ea45ca9c7e517732551ab61ac0ab6012263e5 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 12:52:39 2016 -0700 Renaming and tweaks commit 5ca4cd31ce498f77f21e52c3b1996d7973fff803 Author: Ben Gotow <bengotow@gmail.com> Date: Wed May 25 11:03:57 2016 -0700 Call success with response object as well commit 45f14f9b00415f3575b26b0bde3b829f54a19108 Author: Ben Gotow <bengotow@gmail.com> Date: Tue May 24 18:26:38 2016 -0700 IMAP provider list, validation commit c6ca124e6e94261fc91fe04e284658e0968fc586 Author: Ben Gotow <bengotow@gmail.com> Date: Sat May 21 11:14:44 2016 -0700 New onboarding screens commit dad918d92696e29787c404019e07550b107ec29b Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:37:31 2016 -0700 Remove resizing commit ecb1a569e29ea81085b2e2740dd273c17bc6cc1c Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:36:04 2016 -0700 Scrub packages page, unused code in onboarding pkg commit 3e0a44156cec5dab734cb0d4d10fc0281186f590 Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:33:12 2016 -0700 Enable Templates and Translate by default commit 0d218bc86fe987901efd8e8b36afdb4d8be2b29e Author: Ben Gotow <bengotow@gmail.com> Date: Thu May 19 16:30:47 2016 -0700 Rip out all invite-related code
2016-05-28 05:05:27 +08:00
}