basic authentication stuff

This commit is contained in:
2014-04-06 15:02:53 +02:00
parent 07830df9dd
commit dd8f0df6d2
16 changed files with 128 additions and 56 deletions
@@ -1,9 +1,10 @@
App.ApplicationRoute = Ember.Route.extend
setupController: (controller)->
#@controllerFor('product_orders').set 'model', @store.filter('product_order', (po)-> !po.get('order')) # does not work (yet)
debugger
@controllerFor('product_orders').set 'model', @store.filter('product_order', (po)-> !po.get('id'))
controller.secured ->
faye = new Faye.Client(event_host)
faye = new Faye.Client($event_host)
user_id = Qstorage.getItem('user_id')
faye.subscribe "/user/"+user_id, (e)=>
console.log e
@@ -13,8 +14,7 @@ App.ApplicationRoute = Ember.Route.extend
unauthorized: ->
Qstorage.setItem('auth_token', '')
@controllerFor('application').set 'list', null
@transitionTo('obtain_token').then =>
@controllerFor('application').set('notice', t('messages.unauthorized'))
App.obtain_token(t('messages.unauthorized'))
actions:
openModal: (modalName, model)->
@controllerFor(modalName).set('model', model)
@@ -33,12 +33,14 @@ App.ApplicationRoute = Ember.Route.extend
ok: options.ok
listNeedsPayment: ->
@get('controller').secured ->
$.post(data_host + '/user/list_needs_payment.json', @authentication_object).then (res) =>
@set('list.needs_payment', true)
Ember.$.post '/user/list_needs_payment.json'
#Ember.$.post('/user/list_needs_payment.json').then (res) =>
#@set('list.needs_payment', true) # also done by faye
listNeedsHelp: ->
@get('controller').secured ->
$.post(data_host + '/user/needs_help.json', @authentication_object).then (res) =>
@set('list.needs_help', true)
Ember.$.post '/user/needs_help.json'
#Ember.$.post('/user/needs_help.json').then (res) =>
#@set('list.needs_help', true) # also done by faye
scanQr: ->
@transitionTo 'select_qrcode'
events: ->