Ember initialize hooks

This commit is contained in:
2014-09-30 08:40:28 +02:00
parent 3b5651de47
commit 3d4aab4d67
3 changed files with 18 additions and 8 deletions
@@ -12,19 +12,16 @@
rootElement: '#ember-app-container'
obtain_token: (message)->
message ||= ''
# frame = $('<iframe></iframe>').addClass('obtain-token-frame').attr 'src', $obtain_token_url
# frame.css width: $('body').outerWidth(), height: $('body').outerHeight()
# $('body').append frame
# window.location = "#{$obtain_token_url}"
auth_win = window.open $obtain_token_url, "_blank", "location=no"
auth_win.addEventListener "loadstart", (event)->
if event.url.match 'close_window'
user_id = event.url.match(/user_id=([\w+-]+)/)[1]
auth_token = event.url.match(/auth_token=([\w-]+)/)[1]
auth_token = event.url.match(/authentication_token=([\w-]+)/)[1]
Qstorage.setItem 'user_id', user_id
Qstorage.setItem 'auth_token', token
Qstorage.setItem 'auth_token', auth_token
auth_win.close()
true
App.deferReadiness()
Ember.$.ajaxPrefilter (options) ->
if options.type.toUpperCase() == 'GET'
if auth_token = Qstorage.getItem('auth_token')