From 7907b8fdd1d0a7a7ee18af395e20313cc6027f60 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Thu, 28 Apr 2016 17:06:30 -0700 Subject: [PATCH] fix(onboarding): encode welcome page info --- .../onboarding/lib/page-router-store.coffee | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/internal_packages/onboarding/lib/page-router-store.coffee b/internal_packages/onboarding/lib/page-router-store.coffee index ef2202dda..31cd65617 100644 --- a/internal_packages/onboarding/lib/page-router-store.coffee +++ b/internal_packages/onboarding/lib/page-router-store.coffee @@ -29,11 +29,7 @@ class PageRouterStore extends NylasStore if isFirstAccount @_onMoveToPage('initial-preferences', {account: json}) Actions.recordUserEvent('First Account Linked') - account = AccountStore.accounts()[0] - n1_id = NylasEnv.config.get("updateIdentity") - params = "?n1_id=#{n1_id}&email_address=#{account.emailAddress}&provider=#{account.provider}" - {shell} = require('electron') - shell.openExternal("https://nylas.com/welcome#{params}", activate: false) + @openWelcomePage() else # When account JSON is received, we want to notify external services # that it succeeded. Unfortunately in this case we're likely to @@ -47,6 +43,16 @@ class PageRouterStore extends NylasStore _onWindowPropsChanged: ({page, pageData}={}) => @_onMoveToPage(page, pageData) + openWelcomePage: -> + encode = (str) -> encodeURIComponent(new Buffer(str).toString('base64')) + account = AccountStore.accounts()[0] + n1_id = encode(NylasEnv.config.get("updateIdentity")) + email = encode(account.emailAddress) + provider = encode(account.provider) + params = "?n=#{n1_id}&e=#{email}&p=#{provider}" + {shell} = require('electron') + shell.openExternal("https://nylas.com/welcome#{params}", activate: false) + page: -> @_page pageData: -> @_pageData