Set mask for password if email wizard is opened again.

This commit is contained in:
Martin Edenhofer 2018-01-24 09:24:10 +01:00
parent b059549d88
commit 4fa67c3d0c

View file

@ -478,7 +478,6 @@ class App.ChannelEmailEdit extends App.ControllerModal
class App.ChannelEmailAccountWizard extends App.WizardModal class App.ChannelEmailAccountWizard extends App.WizardModal
elements: elements:
'.modal-body': 'body' '.modal-body': 'body'
events: events:
'submit .js-intro': 'probeBasedOnIntro' 'submit .js-intro': 'probeBasedOnIntro'
'submit .js-inbound': 'probeInbound' 'submit .js-inbound': 'probeInbound'
@ -487,6 +486,9 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
'click .js-goToSlide': 'goToSlide' 'click .js-goToSlide': 'goToSlide'
'click .js-expert': 'probeBasedOnIntro' 'click .js-expert': 'probeBasedOnIntro'
'click .js-close': 'hide' 'click .js-close': 'hide'
inboundPassword: ''
outboundPassword: ''
passwordPlaceholder: '{{{{{{{{{{{{SECRTE_PASSWORD}}}}}}}}}}}}'
constructor: -> constructor: ->
super super
@ -503,9 +505,17 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
if @channel if @channel
@account = @account =
inbound: @channel.options.inbound inbound: clone(@channel.options.inbound)
outbound: @channel.options.outbound outbound: clone(@channel.options.outbound)
meta: {} meta: {}
# remember passwords, do not show in ui
if @account.inbound.options && @account.inbound.options.password
@inboundPassword = @account.inbound.options.password
@account.inbound.options.password = @passwordPlaceholder
if @account.outbound.options && @account.outbound.options.password
@outboundPassword = @account.outbound.options.password
@account.outbound.options.password = @passwordPlaceholder
if @container if @container
@el.addClass('modal--local') @el.addClass('modal--local')
@ -515,17 +525,17 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
if @channel if @channel
@$('.js-goToSlide[data-slide=js-intro]').addClass('hidden') @$('.js-goToSlide[data-slide=js-intro]').addClass('hidden')
@el.modal @el.modal(
keyboard: true keyboard: true
show: true show: true
backdrop: true backdrop: true
container: @container container: @container
.on ).on(
'hidden.bs.modal': => 'hidden.bs.modal': =>
if @callback if @callback
@callback() @callback()
@el.remove() @el.remove()
)
if @slide if @slide
@showSlide(@slide) @showSlide(@slide)
@ -712,6 +722,9 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
# get params # get params
params = @formParam(e.target) params = @formParam(e.target)
if params.options.password is @passwordPlaceholder
params.options.password = @inboundPassword
# let backend know about the channel # let backend know about the channel
if @channel if @channel
params.channel_id = @channel.id params.channel_id = @channel.id
@ -771,6 +784,9 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
params = @formParam(e.target) params = @formParam(e.target)
params['email'] = @account['meta']['email'] params['email'] = @account['meta']['email']
if params.options.password is @passwordPlaceholder
params.options.password = @outboundPassword
if !params['email'] && @channel if !params['email'] && @channel
email_addresses = App.EmailAddress.search(filter: { channel_id: @channel.id }) email_addresses = App.EmailAddress.search(filter: { channel_id: @channel.id })
if email_addresses && email_addresses[0] if email_addresses && email_addresses[0]
@ -867,11 +883,13 @@ class App.ChannelEmailAccountWizard extends App.WizardModal
class App.ChannelEmailNotificationWizard extends App.WizardModal class App.ChannelEmailNotificationWizard extends App.WizardModal
elements: elements:
'.modal-body': 'body' '.modal-body': 'body'
events: events:
'change .js-outbound [name=adapter]': 'toggleOutboundAdapter' 'change .js-outbound [name=adapter]': 'toggleOutboundAdapter'
'submit .js-outbound': 'probleOutbound' 'submit .js-outbound': 'probleOutbound'
'click .js-close': 'hide' 'click .js-close': 'hide'
inboundPassword: ''
outboundPassword: ''
passwordPlaceholder: '{{{{{{{{{{{{SECRTE_PASSWORD}}}}}}}}}}}}'
constructor: -> constructor: ->
super super
@ -888,27 +906,35 @@ class App.ChannelEmailNotificationWizard extends App.WizardModal
if @channel if @channel
@account = @account =
inbound: @channel.options.inbound inbound: clone(@channel.options.inbound)
outbound: @channel.options.outbound outbound: clone(@channel.options.outbound)
# remember passwords, do not show in ui
if @account.inbound && @account.inbound.options && @account.inbound.options.password
@inboundPassword = @account.inbound.options.password
@account.inbound.options.password = @passwordPlaceholder
if @account.outbound && @account.outbound.options && @account.outbound.options.password
@outboundPassword = @account.outbound.options.password
@account.outbound.options.password = @passwordPlaceholder
if @container if @container
@el.addClass('modal--local') @el.addClass('modal--local')
@render() @render()
@el.modal @el.modal(
keyboard: true keyboard: true
show: true show: true
backdrop: true backdrop: true
container: @container container: @container
.on ).on(
'show.bs.modal': @onShow 'show.bs.modal': @onShow
'shown.bs.modal': @onShown 'shown.bs.modal': @onShown
'hidden.bs.modal': => 'hidden.bs.modal': =>
if @callback if @callback
@callback() @callback()
@el.remove() @el.remove()
)
if @slide if @slide
@showSlide(@slide) @showSlide(@slide)
@ -956,6 +982,9 @@ class App.ChannelEmailNotificationWizard extends App.WizardModal
# get params # get params
params = @formParam(e.target) params = @formParam(e.target)
if params.options && params.options.password is @passwordPlaceholder
params.options.password = @outboundPassword
# let backend know about the channel # let backend know about the channel
params.channel_id = @channel.id params.channel_id = @channel.id