Add Yahoo app password note, include notes in “View Log” text

This commit is contained in:
Ben Gotow 2018-11-03 18:48:21 -07:00
parent 20dbfbab75
commit 79d6491808
2 changed files with 22 additions and 0 deletions

View file

@ -18,6 +18,17 @@ const AccountProviders = [
{
provider: 'yahoo',
displayName: 'Yahoo',
note: (
<span>
<strong>{localized('Important')}:</strong>{' '}
{localizedReactFragment(
'Yahoo requires that you create a unique app password for email apps like Mailspring. Follow %@ to create one and then paste it below.',
<a href="https://help.yahoo.com/kb/SLN15241.html?guccounter=1">
{localized('these instructions')}
</a>
)}
</span>
),
icon: 'ic-settings-account-yahoo.png',
headerIcon: 'setup-icon-provider-yahoo.png',
color: '#a76ead',

View file

@ -121,6 +121,7 @@ const CreatePageForForm = FormComponent => {
onConnect = updatedAccount => {
const account = updatedAccount || this.state.account;
const providerConfig = AccountProviders.find(({ provider }) => provider === account.provider);
// warn users about authenticating a Gmail or Google Apps account via IMAP
// and allow them to go back
@ -173,6 +174,16 @@ const CreatePageForForm = FormComponent => {
}
}
if (providerConfig.note) {
const node = document.createElement('div');
ReactDOM.render(providerConfig.note, node);
let note = node.innerText;
const link = node.querySelector('a');
if (link) {
note += '\n' + link.getAttribute('href');
}
err.rawLog = note + '\n\n' + err.rawLog;
}
this.setState({
errorMessage: err.message,
errorStatusCode: err.statusCode,