     @setElementEnabled(@password, false)
     @setElementEnabled(@signIn, false)
 
-    credentials = btoa("#{$.trim(@username.val())}:#{@password.val()}")
+    username = $.trim(@username.val())
+    credentials = btoa("#{username}:#{@password.val()}")
     request =
       scopes: ['user', 'repo', 'gist']
       note: 'GitHub Atom'


      success: ({token}={}) =>
        if token?.length > 0
          unless keytar.replacePassword('github.com', 'github', token)
            console.warn 'Unable to save GitHub token to keychain'
        @detach()

        @button outlet: 'cancel', class: 'btn', tabindex: 4, 'Cancel'
      @div outlet: 'alert', class: 'alert alert-error'

  initialize: ({@signedInUser}={})->
    rootView.command 'github:sign-in', => @attach()

    @username.on 'core:confirm', => @generateOAuth2Token()
