Fixed #118 - moved to sessionStorage to clear date after browser close.
This commit is contained in:
parent
e25dcf891d
commit
9aa3ae7348
2 changed files with 10 additions and 3 deletions
|
@ -30,7 +30,7 @@ class App.Auth
|
||||||
success: (data, status, xhr) =>
|
success: (data, status, xhr) =>
|
||||||
|
|
||||||
# set login (config, session, ...)
|
# set login (config, session, ...)
|
||||||
@_login(data)
|
@_login(data, 'check')
|
||||||
|
|
||||||
error: (xhr, statusText, error) =>
|
error: (xhr, statusText, error) =>
|
||||||
@_loginError()
|
@_loginError()
|
||||||
|
@ -51,7 +51,7 @@ class App.Auth
|
||||||
@_loginError()
|
@_loginError()
|
||||||
)
|
)
|
||||||
|
|
||||||
@_login: (data) ->
|
@_login: (data, type) ->
|
||||||
App.Log.notice 'Auth', '_login:success', data
|
App.Log.notice 'Auth', '_login:success', data
|
||||||
|
|
||||||
# if session is not valid
|
# if session is not valid
|
||||||
|
@ -71,6 +71,10 @@ class App.Auth
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
# clear local store
|
||||||
|
if type isnt 'check'
|
||||||
|
App.Event.trigger( 'clearStore' )
|
||||||
|
|
||||||
# set avatar
|
# set avatar
|
||||||
data.session.image = App.Config.get('api_path') + '/users/image/' + data.session.image
|
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' )
|
||||||
App.Event.trigger( 'auth:logout' )
|
App.Event.trigger( 'auth:logout' )
|
||||||
App.Event.trigger( 'ui:rerender' )
|
App.Event.trigger( 'ui:rerender' )
|
||||||
|
App.Event.trigger( 'clearStore' )
|
||||||
|
|
||||||
@_loginError: (xhr, statusText, error) ->
|
@_loginError: (xhr, statusText, error) ->
|
||||||
App.Log.notice 'Auth', '_loginError:error'
|
App.Log.notice 'Auth', '_loginError:error'
|
||||||
|
@ -121,3 +126,5 @@ class App.Auth
|
||||||
App.Event.trigger( 'auth' )
|
App.Event.trigger( 'auth' )
|
||||||
App.Event.trigger( 'auth:logout' )
|
App.Event.trigger( 'auth:logout' )
|
||||||
App.Event.trigger( 'ui:rerender' )
|
App.Event.trigger( 'ui:rerender' )
|
||||||
|
App.Event.trigger( 'clearStore' )
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ class _storeSingleton
|
||||||
|
|
||||||
# clear store on every login/logout
|
# clear store on every login/logout
|
||||||
if @support
|
if @support
|
||||||
App.Event.bind 'auth', =>
|
App.Event.bind 'clearStore', =>
|
||||||
@clear('all')
|
@clear('all')
|
||||||
|
|
||||||
# write to local storage
|
# write to local storage
|
||||||
|
|
Loading…
Reference in a new issue