Fixed #118 - moved to sessionStorage to clear date after browser close.

This commit is contained in:
Martin Edenhofer 2014-01-21 23:05:55 +01:00
parent e25dcf891d
commit 9aa3ae7348
2 changed files with 10 additions and 3 deletions

View file

@ -30,7 +30,7 @@ class App.Auth
success: (data, status, xhr) =>
# set login (config, session, ...)
@_login(data)
@_login(data, 'check')
error: (xhr, statusText, error) =>
@_loginError()
@ -51,7 +51,7 @@ class App.Auth
@_loginError()
)
@_login: (data) ->
@_login: (data, type) ->
App.Log.notice 'Auth', '_login:success', data
# if session is not valid
@ -71,6 +71,10 @@ class App.Auth
return false;
# clear local store
if type isnt 'check'
App.Event.trigger( 'clearStore' )
# set avatar
data.session.image = App.Config.get('api_path') + '/users/image/' + data.session.image
@ -110,6 +114,7 @@ class App.Auth
App.Event.trigger( 'auth' )
App.Event.trigger( 'auth:logout' )
App.Event.trigger( 'ui:rerender' )
App.Event.trigger( 'clearStore' )
@_loginError: (xhr, statusText, error) ->
App.Log.notice 'Auth', '_loginError:error'
@ -121,3 +126,5 @@ class App.Auth
App.Event.trigger( 'auth' )
App.Event.trigger( 'auth:logout' )
App.Event.trigger( 'ui:rerender' )
App.Event.trigger( 'clearStore' )

View file

@ -39,7 +39,7 @@ class _storeSingleton
# clear store on every login/logout
if @support
App.Event.bind 'auth', =>
App.Event.bind 'clearStore', =>
@clear('all')
# write to local storage