     _.extend(this, data.user)
     @courses = _.map data.courses, (course) => new Course(@, course)
     @channel.emit('change')
+    delete @isLoggingOut
 
   logout: ->
     _.extend(this, BLANK_USER)
+    @isLoggingOut = true
     @channel.emit('change')
 
   getCourse: (collectionUUID) ->


  onCourseUpdate: (course) ->
    @channel.emit('change')
  removeCourse: (course) ->
    index = @courses.indexOf(course)
    @courses.splice(index, 1) unless index is -1

  if data.access_token
    api.channel.emit('set.access_token', data.access_token)
  User.endpoints = data.endpoints
  if data.user
    User.update(data)
  else
    _.extend(this, BLANK_USER)
    User.channel.emit('change')


# start out as a blank user
_.extend(User, BLANK_USER)
