Avoid http redirects, they will be cached on some browsers.
This commit is contained in:
parent
13d23f96cd
commit
7d6ab22cae
3 changed files with 43 additions and 22 deletions
|
@ -100,7 +100,7 @@ class App.Controller extends Spine.Controller
|
|||
disconnectClient: ->
|
||||
App.Delay.reset()
|
||||
App.Interval.reset()
|
||||
App.WebSocket.close( force: true )
|
||||
App.WebSocket.close(force: true)
|
||||
|
||||
# add @notify methode to create notification
|
||||
notify: (data) ->
|
||||
|
@ -574,6 +574,22 @@ class App.Controller extends Spine.Controller
|
|||
e.currentTarget.focus()
|
||||
e.currentTarget.select()
|
||||
|
||||
windowReload: (e,url) ->
|
||||
if e
|
||||
e.preventDefault()
|
||||
$('#app').hide().attr('style', 'display: none!important')
|
||||
if url
|
||||
window.location = url
|
||||
return true
|
||||
if window.location.reload
|
||||
window.location.reload()
|
||||
return true
|
||||
if window.location.href
|
||||
window.location.href = window.location.href
|
||||
return true
|
||||
|
||||
throw 'Cant reload page!'
|
||||
|
||||
class App.ControllerPermanent extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
|
@ -726,31 +742,18 @@ class App.ControllerModal extends App.Controller
|
|||
class App.SessionMessage extends App.ControllerModal
|
||||
onCancel: (e) =>
|
||||
if @forceReload
|
||||
@reload(e)
|
||||
@windowReload(e)
|
||||
|
||||
onClose: (e) =>
|
||||
if @forceReload
|
||||
@reload(e)
|
||||
@windowReload(e)
|
||||
|
||||
onSubmit: (e) =>
|
||||
if @forceReload
|
||||
@reload(e)
|
||||
@windowReload(e)
|
||||
else
|
||||
@close()
|
||||
|
||||
reload: (e) ->
|
||||
if e
|
||||
e.preventDefault()
|
||||
$('#app').hide().attr('style', 'display: none!important')
|
||||
if window.location.reload
|
||||
window.location.reload()
|
||||
return true
|
||||
if window.location.href
|
||||
window.location.href = window.location.href
|
||||
return true
|
||||
|
||||
throw 'Cant reload page!'
|
||||
|
||||
class App.UpdateHeader extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
|
|
|
@ -76,10 +76,17 @@ class Index extends App.Controller
|
|||
@disconnectClient()
|
||||
$('#app').hide().attr('style', 'display: none!important')
|
||||
@delay(
|
||||
->
|
||||
=>
|
||||
App.Auth._logout()
|
||||
window.location = App.Config.get('api_path') + '/sessions/switch/' + id
|
||||
1200
|
||||
@ajax(
|
||||
id: 'user_switch'
|
||||
type: 'GET'
|
||||
url: "#{@apiPath}/sessions/switch/#{id}"
|
||||
success: (data, status, xhr) =>
|
||||
location = "#{window.location.protocol}//#{window.location.host}#{data.location}"
|
||||
@windowReload(undefined, location)
|
||||
)
|
||||
800
|
||||
)
|
||||
|
||||
edit = (id, e) =>
|
||||
|
|
|
@ -34,7 +34,18 @@ class Widget extends App.ControllerWidgetOnDemand
|
|||
e.preventDefault()
|
||||
@disconnectClient()
|
||||
$('#app').hide().attr('style', 'display: none!important')
|
||||
App.Auth._logout()
|
||||
window.location = App.Config.get('api_path') + '/sessions/switch_back'
|
||||
@delay(
|
||||
=>
|
||||
App.Auth._logout()
|
||||
@ajax(
|
||||
id: 'user_switch_back'
|
||||
type: 'GET'
|
||||
url: "#{@apiPath}/sessions/switch_back"
|
||||
success: (data, status, xhr) =>
|
||||
location = "#{window.location.protocol}//#{window.location.host}#{data.location}"
|
||||
@windowReload(undefined, location)
|
||||
)
|
||||
800
|
||||
)
|
||||
|
||||
App.Config.set( 'switch_back_to_user', Widget, 'Widgets' )
|
||||
|
|
Loading…
Reference in a new issue