     @passwordEditor.hiddenInput.attr 'disabled', 'disabled'
     @loginButton.attr 'disabled', 'disabled'
     @spinner.removeClass 'hidden'
+    @errorLabel.hide()
 
+    self = @
     client = new ApiClient settings.apiUrl
+    @loginPromise = client.login 'spark-ide', @email, @password
+    @loginPromise.done (e) ->
+      self.spinner.addClass 'hidden'
+      if !self.loginPromise
+        return
+    , (e) ->
+      self.spinner.addClass 'hidden'
+      if !self.loginPromise
+        return
+      self.unlockUi()
+      self.errorLabel.text(e).show()

      @emailEditor.getEditor().setText ''
      @passwordEditor.getEditor().setText ''
      @passwordEditor.originalText = ''

  hide: ->
    if @hasParent()

          @span ' key'
      @subview 'emailEditor', new EditorView(mini: true, placeholderText: 'Could I please have an email address?'), outlet: 'emailEditor'
      @subview 'passwordEditor', new EditorView(mini: true, placeholderText: 'and a password?'), outlet: 'passwordEditor'
      @div class: 'text-error block', outlet: 'errorLabel'
      @div class: 'block', =>
        @button click: 'login', class: 'btn btn-primary', outlet: 'loginButton', 'Log in'
        @button click: 'cancel', class: 'btn', outlet: 'cancelButton', 'Cancel'
