Added ability to define port for imap/pop3 and smtp (also for notification channel).

This commit is contained in:
Martin Edenhofer 2016-12-12 15:06:01 +01:00
parent 51985bc67e
commit 0bd8b158e3
4 changed files with 60 additions and 13 deletions

View file

@ -528,7 +528,8 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
{ name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false },
{ name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'off', },
{ name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true },
{ name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false },
{ name: 'options::ssl', display: 'SSL', tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, default: true, translate: true, item_class: 'formGroup--halfSize' },
{ name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false, default: '993', item_class: 'formGroup--halfSize' },
{ name: 'options::folder', display: 'Folder', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false },
]
@ -539,6 +540,19 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
return
ui.hide('options::folder')
handlePort = (params, attribute, attributes, classname, form, ui) ->
return if !params
return if !params.options
currentPort = @$('[name="options::port"]').val()
if params.options.ssl is true
if !currentPort || currentPort is '143'
@$('[name="options::port"]').val('993')
return
if params.options.ssl is false
if !currentPort || currentPort is '993'
@$('[name="options::port"]').val('143')
return
new App.ControllerForm(
el: @$('.base-inbound-settings'),
model:
@ -546,7 +560,8 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
className: ''
params: @account.inbound
handlers: [
showHideFolder
showHideFolder,
handlePort,
]
)
@ -593,6 +608,8 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
# validate form
errors = @formMeta.validate(params)
if errors
delete errors.password
if !_.isEmpty(errors)
@formValidate(form: e.target, errors: errors)
return
@ -877,6 +894,7 @@ class App.ChannelEmailNotificationWizard extends App.WizardModal
{ name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autofocus: true },
{ name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, autocomplete: 'off' },
{ name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password', single: true },
{ name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false },
]
@form = new App.ControllerForm(
el: @$('.base-outbound-settings')
@ -902,8 +920,8 @@ class App.ChannelEmailNotificationWizard extends App.WizardModal
@ajax(
id: 'email_outbound'
type: 'POST'
url: @apiPath + '/channels/email_notification'
data: JSON.stringify( params )
url: "#{@apiPath}/channels/email_notification"
data: JSON.stringify(params)
processData: true
success: (data, status, xhr) =>
if data.result is 'ok'

View file

@ -452,6 +452,7 @@ class EmailNotification extends App.WizardFullScreen
{ name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autofocus: true },
{ name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, autocomplete: 'off' },
{ name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password', single: true },
{ name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false },
]
@form = new App.ControllerForm(
el: @$('.base-outbound-settings')
@ -479,7 +480,7 @@ class EmailNotification extends App.WizardFullScreen
success: (data, status, xhr) =>
if data.result is 'ok'
for key, value of data.settings
App.Config.set( key, value )
App.Config.set(key, value)
if App.Config.get('system_online_service')
@navigate 'getting_started/channel/email_pre_configured'
else
@ -674,13 +675,40 @@ class ChannelEmail extends App.WizardFullScreen
{ name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false },
{ name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'off', },
{ name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true },
{ name: 'options::ssl', display: 'SSL', tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, default: true, translate: true, item_class: 'formGroup--halfSize' },
{ name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false, default: '993', item_class: 'formGroup--halfSize' },
]
showHideFolder = (params, attribute, attributes, classname, form, ui) ->
return if !params
if params.adapter is 'imap'
ui.show('options::folder')
return
ui.hide('options::folder')
handlePort = (params, attribute, attributes, classname, form, ui) ->
return if !params
return if !params.options
currentPort = @$('.base-inbound-settings [name="options::port"]').val()
if params.options.ssl is true
if !currentPort || currentPort is '143'
@$('.base-inbound-settings [name="options::port"]').val('993')
return
if params.options.ssl is false
if !currentPort || currentPort is '993'
@$('.base-inbound-settings [name="options::port"]').val('143')
return
new App.ControllerForm(
el: @$('.base-inbound-settings'),
model:
configure_attributes: configureAttributesInbound
className: ''
params: @account.inbound
handlers: [
showHideFolder,
handlePort,
]
)
toggleOutboundAdapter: =>
@ -699,6 +727,7 @@ class ChannelEmail extends App.WizardFullScreen
{ name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autofocus: true },
{ name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, autocomplete: 'off', },
{ name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password', single: true },
{ name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false },
]
@form = new App.ControllerForm(
el: @$('.base-outbound-settings')

View file

@ -1,6 +1,6 @@
<div class="modal-dialog wizard">
<form class="modal-content setup wizard js-intro">
<form autocomplete="off" class="modal-content setup wizard js-intro">
<!-- dummy to prevent chrome to ask for password save -->
<input style="display:none">
<input type="password" style="display:none">
@ -27,7 +27,7 @@
</div>
</form>
<form class="modal-content setup wizard hide js-probe">
<form autocomplete="off" class="modal-content setup wizard hide js-probe">
<div class="modal-header">
<div class="modal-close js-close">
<%- @Icon('diagonal-cross') %>
@ -44,7 +44,7 @@
<div class="modal-footer"></div>
</form>
<form class="modal-content setup wizard hide js-test">
<form autocomplete="off" class="modal-content setup wizard hide js-test">
<div class="modal-header">
<div class="modal-close js-close">
<%- @Icon('diagonal-cross') %>
@ -61,7 +61,7 @@
<div class="modal-footer"></div>
</form>
<form class="modal-content setup wizard hide js-verify">
<form autocomplete="off" class="modal-content setup wizard hide js-verify">
<div class="modal-header">
<div class="modal-close js-close">
<%- @Icon('diagonal-cross') %>
@ -79,7 +79,7 @@
<div class="modal-footer"></div>
</form>
<form class="modal-content setup wizard hide js-inbound">
<form autocomplete="off" class="modal-content setup wizard hide js-inbound">
<!-- dummy to prevent chrome to ask for password save -->
<input style="display:none">
<input type="password" style="display:none">
@ -106,7 +106,7 @@
</div>
</form>
<form class="modal-content setup wizard hide js-inbound-acknowledge">
<form autocomplete="off" class="modal-content setup wizard hide js-inbound-acknowledge">
<div class="modal-header">
<div class="modal-close js-close">
<%- @Icon('diagonal-cross') %>
@ -129,7 +129,7 @@
</div>
</form>
<form class="modal-content setup wizard hide js-outbound">
<form autocomplete="off" class="modal-content setup wizard hide js-outbound">
<!-- dummy to prevent chrome to ask for password save -->
<input style="display:none">
<input type="password" style="display:none">

View file

@ -130,7 +130,7 @@ module Channel::EmailBuild
quoted_in_one_line = Channel::EmailBuild.recipient_line('Somebody @ "Company"', 'some.body@example.com')
returnes
returns
'"Somebody @ \"Company\"" <some.body@example.com>'