mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-06 13:03:10 +08:00
Update mailsync to use OAuth for Outlook, outlook.office.com as the scope
This commit is contained in:
parent
9d4bd33c96
commit
033799f35b
6 changed files with 52 additions and 9 deletions
|
@ -17,14 +17,16 @@ export const GMAIL_CLIENT_ID =
|
|||
// Note: This is not a security risk for the end-user -- it just means someone could "fork" Mailspring and re-use it's
|
||||
// Client ID and Secret. For now, it seems we're on the honor code - Please don't do this.
|
||||
//
|
||||
export const GMAIL_CLIENT_SECRET = process.env.MS_GMAIL_CLIENT_SECRET || crypto
|
||||
.createDecipheriv(
|
||||
'aes-256-ctr',
|
||||
"don't-be-ev1l-thanks--mailspring",
|
||||
Buffer.from('wgvAx+N05nHqhFxJ9I07jw==', 'base64')
|
||||
)
|
||||
.update(Buffer.from('1EyEGYVh3NBNIbYEdpdMvOzCH7+vrSciGeYZ1F+W6W+yShk=', 'base64'))
|
||||
.toString('utf8');
|
||||
export const GMAIL_CLIENT_SECRET =
|
||||
process.env.MS_GMAIL_CLIENT_SECRET ||
|
||||
crypto
|
||||
.createDecipheriv(
|
||||
'aes-256-ctr',
|
||||
"don't-be-ev1l-thanks--mailspring",
|
||||
Buffer.from('wgvAx+N05nHqhFxJ9I07jw==', 'base64')
|
||||
)
|
||||
.update(Buffer.from('1EyEGYVh3NBNIbYEdpdMvOzCH7+vrSciGeYZ1F+W6W+yShk=', 'base64'))
|
||||
.toString('utf8');
|
||||
|
||||
export const GMAIL_SCOPES = [
|
||||
'https://mail.google.com/', // email
|
||||
|
|
|
@ -15,6 +15,7 @@ import AccountSettingsPageIMAP from './page-account-settings-imap';
|
|||
import AccountOnboardingSuccess from './page-account-onboarding-success';
|
||||
import InitialPreferencesPage from './page-initial-preferences';
|
||||
import InitialSubscriptionPage from './page-initial-subscription';
|
||||
import AccountSettingsPageOutlook from './page-account-settings-outlook';
|
||||
|
||||
const PageComponents = {
|
||||
welcome: WelcomePage,
|
||||
|
@ -24,6 +25,7 @@ const PageComponents = {
|
|||
'account-settings': AccountSettingsPage,
|
||||
'account-settings-gmail': AccountSettingsPageGmail,
|
||||
'account-settings-o365': AccountSettingsPageO365,
|
||||
'account-settings-outlook': AccountSettingsPageOutlook,
|
||||
'account-settings-imap': AccountSettingsPageIMAP,
|
||||
'account-onboarding-success': AccountOnboardingSuccess,
|
||||
'initial-preferences': InitialPreferencesPage,
|
||||
|
|
|
@ -43,6 +43,8 @@ class OnboardingStore extends MailspringStore {
|
|||
this._pageStack = ['account-choose', 'account-settings-gmail'];
|
||||
} else if (this._account.provider === 'office365') {
|
||||
this._pageStack = ['account-choose', 'account-settings-o365'];
|
||||
} else if (this._account.provider === 'outlook') {
|
||||
this._pageStack = ['account-choose', 'account-settings-outlook'];
|
||||
} else if (this._account.provider === 'imap') {
|
||||
this._pageStack = ['account-choose', 'account-settings', 'account-settings-imap'];
|
||||
} else {
|
||||
|
@ -84,6 +86,8 @@ class OnboardingStore extends MailspringStore {
|
|||
? 'account-settings-gmail'
|
||||
: provider === 'office365'
|
||||
? 'account-settings-o365'
|
||||
: provider === 'outlook'
|
||||
? 'account-settings-outlook'
|
||||
: 'account-settings';
|
||||
|
||||
// Don't carry over any type-specific account information
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
import React from 'react';
|
||||
|
||||
import { Account } from 'mailspring-exports';
|
||||
import { buildO365AccountFromAuthResponse, buildO365AuthURL } from './onboarding-helpers';
|
||||
|
||||
import OAuthSignInPage from './oauth-signin-page';
|
||||
import * as OnboardingActions from './onboarding-actions';
|
||||
import AccountProviders from './account-providers';
|
||||
|
||||
export default class AccountSettingsPageOutlook extends React.Component<{ account: Account }> {
|
||||
static displayName = 'AccountSettingsPageOutlook';
|
||||
|
||||
_authUrl = buildO365AuthURL();
|
||||
|
||||
onSuccess(account) {
|
||||
OnboardingActions.finishAndAddAccount(account);
|
||||
}
|
||||
|
||||
render() {
|
||||
const providerConfig = AccountProviders.find(a => a.provider === this.props.account.provider);
|
||||
const goBack = () => OnboardingActions.moveToPreviousPage();
|
||||
|
||||
return (
|
||||
<OAuthSignInPage
|
||||
serviceName="Outlook"
|
||||
providerAuthPageUrl={this._authUrl}
|
||||
providerConfig={providerConfig}
|
||||
buildAccountFromAuthResponse={buildO365AccountFromAuthResponse}
|
||||
onSuccess={this.onSuccess}
|
||||
onTryAgain={goBack}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -364,6 +364,7 @@
|
|||
}
|
||||
.page.account-setup.google,
|
||||
.page.account-setup.office,
|
||||
.page.account-setup.outlook,
|
||||
.page.account-setup.AccountOnboardingSuccess {
|
||||
.logo-container {
|
||||
padding-top: 160px;
|
||||
|
|
2
mailsync
2
mailsync
|
@ -1 +1 @@
|
|||
Subproject commit 06215f5675cd34e3951e207bb0e34670c779c9d0
|
||||
Subproject commit f7f0b7701fea07dd3cbd07eeec59fcf5bbae93ae
|
Loading…
Reference in a new issue