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::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::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::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 }, { 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 return
ui.hide('options::folder') 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( new App.ControllerForm(
el: @$('.base-inbound-settings'), el: @$('.base-inbound-settings'),
model: model:
@ -546,7 +560,8 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
className: '' className: ''
params: @account.inbound params: @account.inbound
handlers: [ handlers: [
showHideFolder showHideFolder,
handlePort,
] ]
) )
@ -593,6 +608,8 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
# validate form # validate form
errors = @formMeta.validate(params) errors = @formMeta.validate(params)
if errors if errors
delete errors.password
if !_.isEmpty(errors)
@formValidate(form: e.target, errors: errors) @formValidate(form: e.target, errors: errors)
return 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::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::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::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( @form = new App.ControllerForm(
el: @$('.base-outbound-settings') el: @$('.base-outbound-settings')
@ -902,7 +920,7 @@ class App.ChannelEmailNotificationWizard extends App.WizardModal
@ajax( @ajax(
id: 'email_outbound' id: 'email_outbound'
type: 'POST' type: 'POST'
url: @apiPath + '/channels/email_notification' url: "#{@apiPath}/channels/email_notification"
data: JSON.stringify(params) data: JSON.stringify(params)
processData: true processData: true
success: (data, status, xhr) => success: (data, status, xhr) =>

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::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::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::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( @form = new App.ControllerForm(
el: @$('.base-outbound-settings') el: @$('.base-outbound-settings')
@ -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::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::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::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( new App.ControllerForm(
el: @$('.base-inbound-settings'), el: @$('.base-inbound-settings'),
model: model:
configure_attributes: configureAttributesInbound configure_attributes: configureAttributesInbound
className: '' className: ''
params: @account.inbound params: @account.inbound
handlers: [
showHideFolder,
handlePort,
]
) )
toggleOutboundAdapter: => 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::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::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::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( @form = new App.ControllerForm(
el: @$('.base-outbound-settings') el: @$('.base-outbound-settings')

View file

@ -1,6 +1,6 @@
<div class="modal-dialog wizard"> <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 --> <!-- dummy to prevent chrome to ask for password save -->
<input style="display:none"> <input style="display:none">
<input type="password" style="display:none"> <input type="password" style="display:none">
@ -27,7 +27,7 @@
</div> </div>
</form> </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-header">
<div class="modal-close js-close"> <div class="modal-close js-close">
<%- @Icon('diagonal-cross') %> <%- @Icon('diagonal-cross') %>
@ -44,7 +44,7 @@
<div class="modal-footer"></div> <div class="modal-footer"></div>
</form> </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-header">
<div class="modal-close js-close"> <div class="modal-close js-close">
<%- @Icon('diagonal-cross') %> <%- @Icon('diagonal-cross') %>
@ -61,7 +61,7 @@
<div class="modal-footer"></div> <div class="modal-footer"></div>
</form> </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-header">
<div class="modal-close js-close"> <div class="modal-close js-close">
<%- @Icon('diagonal-cross') %> <%- @Icon('diagonal-cross') %>
@ -79,7 +79,7 @@
<div class="modal-footer"></div> <div class="modal-footer"></div>
</form> </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 --> <!-- dummy to prevent chrome to ask for password save -->
<input style="display:none"> <input style="display:none">
<input type="password" style="display:none"> <input type="password" style="display:none">
@ -106,7 +106,7 @@
</div> </div>
</form> </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-header">
<div class="modal-close js-close"> <div class="modal-close js-close">
<%- @Icon('diagonal-cross') %> <%- @Icon('diagonal-cross') %>
@ -129,7 +129,7 @@
</div> </div>
</form> </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 --> <!-- dummy to prevent chrome to ask for password save -->
<input style="display:none"> <input style="display:none">
<input type="password" 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') quoted_in_one_line = Channel::EmailBuild.recipient_line('Somebody @ "Company"', 'some.body@example.com')
returnes returns
'"Somebody @ \"Company\"" <some.body@example.com>' '"Somebody @ \"Company\"" <some.body@example.com>'