       title          : 'Use Gravatar'
       callback       : =>
         @account.modify "profile.avatar": ""
+    
+    #@switch = new KodingSwitch
+        
 
     @emailForm = new KDFormViewWithFields
       cssClass             : 'AppModal-form'

  update: (formData) ->

    {JUser} = remote.api
    {email, password, confirmPassword, firstName, lastName, username} = formData

    profileUpdated = yes
    skipPasswordConfirmation = no
    queue = [
      =>
        # update firstname and lastname
        me = whoami()
        {profile:{firstName:oldFirstName, lastName:oldLastName}} = me
        # do not do anything if current firstname and lastname is same
        return queue.next() if oldFirstName is firstName and oldLastName is lastName

        me.modify {
          "profile.firstName": firstName,
          "profile.lastName" : lastName
        }, (err)->
          return notify err.message  if err
          queue.next()


    {email} = @userInfo
    {nickname, firstName, lastName} = @account.profile
   
    console.log @emailForm
    @emailForm.inputs.email.setDefaultValue Encoder.htmlDecode email
    @emailForm.inputs.username.setDefaultValue Encoder.htmlDecode nickname
    @emailForm.inputs.firstName.setDefaultValue Encoder.htmlDecode firstName
    @emailForm.inputs.lastName.setDefaultValue Encoder.htmlDecode lastName
    @emailForm.inputs.shareLocation.setDefaultValue whoami().shareLocation
    console.log whoami()
    {focus} = kd.utils.parseQuery()
    @emailForm.inputs[focus]?.setFocus()  if focus

