mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-09 22:45:16 +08:00
Turn off SSL/TLS by default if the user selects ports 143, 25
This commit is contained in:
parent
03131a8acb
commit
65fcb48c37
2 changed files with 27 additions and 5 deletions
|
@ -84,6 +84,25 @@ class AccountIMAPSettingsForm extends React.Component {
|
||||||
const isStandard = values.includes(settings[field] / 1);
|
const isStandard = values.includes(settings[field] / 1);
|
||||||
const customValue = isStandard ? '0' : settings[field];
|
const customValue = isStandard ? '0' : settings[field];
|
||||||
|
|
||||||
|
// When you change the port, automatically switch the security setting to
|
||||||
|
// the standard for that port. Lots of people don't update that field and
|
||||||
|
// are getting confused.
|
||||||
|
const onPortChange = event => {
|
||||||
|
onFieldChange(event);
|
||||||
|
if (event.target.value / 1 === 143 && settings.imap_security !== 'none') {
|
||||||
|
onFieldChange({ target: { value: 'none', id: 'settings.imap_security' } });
|
||||||
|
}
|
||||||
|
if (event.target.value / 1 === 993 && settings.imap_security !== 'SSL / TLS') {
|
||||||
|
onFieldChange({ target: { value: 'SSL / TLS', id: 'settings.imap_security' } });
|
||||||
|
}
|
||||||
|
if (event.target.value / 1 === 25 && settings.smtp_security !== 'none') {
|
||||||
|
onFieldChange({ target: { value: 'none', id: 'settings.smtp_security' } });
|
||||||
|
}
|
||||||
|
if (event.target.value / 1 === 587 && settings.smtp_security !== 'STARTTLS') {
|
||||||
|
onFieldChange({ target: { value: 'STARTTLS', id: 'settings.smtp_security' } });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
<label htmlFor={`settings.${field}`}>Port:</label>
|
<label htmlFor={`settings.${field}`}>Port:</label>
|
||||||
|
@ -92,8 +111,7 @@ class AccountIMAPSettingsForm extends React.Component {
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
value={settings[field]}
|
value={settings[field]}
|
||||||
disabled={submitting}
|
disabled={submitting}
|
||||||
onKeyPress={onFieldKeyPress}
|
onChange={onPortChange}
|
||||||
onChange={onFieldChange}
|
|
||||||
>
|
>
|
||||||
{values.map(v => (
|
{values.map(v => (
|
||||||
<option value={v} key={v}>
|
<option value={v} key={v}>
|
||||||
|
@ -138,7 +156,7 @@ class AccountIMAPSettingsForm extends React.Component {
|
||||||
onKeyPress={onFieldKeyPress}
|
onKeyPress={onFieldKeyPress}
|
||||||
onChange={onFieldChange}
|
onChange={onFieldChange}
|
||||||
>
|
>
|
||||||
<option value="SSL / TLS" key="SSL">
|
<option value="SSL / TLS" key="SSL / TLS">
|
||||||
SSL / TLS
|
SSL / TLS
|
||||||
</option>
|
</option>
|
||||||
<option value="STARTTLS" key="STARTTLS">
|
<option value="STARTTLS" key="STARTTLS">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { React, PropTypes, RegExpUtils } from 'mailspring-exports';
|
import { Account, React, PropTypes, RegExpUtils } from 'mailspring-exports';
|
||||||
|
|
||||||
import OnboardingActions from './onboarding-actions';
|
import OnboardingActions from './onboarding-actions';
|
||||||
import CreatePageForForm from './decorators/create-page-for-form';
|
import CreatePageForForm from './decorators/create-page-for-form';
|
||||||
|
@ -54,8 +54,12 @@ class AccountBasicSettingsForm extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
const account = expandAccountWithCommonSettings(this.props.account);
|
// create a new account with expanded settings and just the three fields
|
||||||
|
const { name, emailAddress, provider, settings: { imap_password } } = this.props.account;
|
||||||
|
let account = new Account({ name, emailAddress, provider, settings: { imap_password } });
|
||||||
|
account = expandAccountWithCommonSettings(account);
|
||||||
OnboardingActions.setAccount(account);
|
OnboardingActions.setAccount(account);
|
||||||
|
|
||||||
if (this.props.account.provider === 'imap') {
|
if (this.props.account.provider === 'imap') {
|
||||||
OnboardingActions.moveToPage('account-settings-imap');
|
OnboardingActions.moveToPage('account-settings-imap');
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue