Sha256: 63adac8b4d7dc75270eca41642e42f434913edc76027a5956ed1db31f1b9f656

Contents?: true

Size: 658 Bytes

Versions: 20

Compression:

Stored size: 658 Bytes

Contents

class Apiv1.ModalsLoginController extends Ember.ObjectController
  +computed model
  session: -> 
    @login @model
    @model

  +computed session.id
  isAuthenticated: -> @get("session.id")

  login: (session) ->
    session.save().then(_.bind @successfulLogin, @).catch(_.bind @failedLogin, @)

  successfulLogin: (session) ->
    Apiv1.Flash.register "success", "Admin logged in", 5000
    @transitionToRoute "admin.index"

  failedLogin: _.after 1, (reason) ->
    Apiv1.Flash.register "warning", "login failed", 5000
    @failureReason = reason.responseJSON.admin_session if reason.responseJSON?


  actions:
    formSubmitted: ->
      @login @session

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
cloudrider-0.3.0 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.18 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.15 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.14 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.12 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.11 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.10 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.9 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.8 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.7 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.6 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.5 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.4 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.3 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.2 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.1 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.2.0 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.1.3 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.1.2 generica/app/assets/javascripts/controllers/modals/login_controller.js.em
cloudrider-0.1.0 generica/app/assets/javascripts/controllers/modals/login_controller.js.em