Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Handle lack of username
Browse files Browse the repository at this point in the history
  • Loading branch information
notnotdrew committed Jul 19, 2016
1 parent ca93828 commit d121dd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions backend/ide-init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ confirmOauthToken = (token) ->
parsed = JSON.parse(body)
console.log parsed

if parsed.username
if parsed.email
resolve parsed
else
resolve false
Expand Down Expand Up @@ -89,11 +89,13 @@ window.learnSignIn = ->
webContents.on 'did-get-redirect-request', (e, oldURL, newURL) ->
if newURL.match(/ide_token/)
token = url.parse(newURL, true).query.ide_token
confirmOauthToken(token).then (res) ->
return unless res
atom.config.set('integrated-learn-environment.oauthToken', token)
atom.config.set('integrated-learn-environment.vm_port', res.vm_uid)
atom.commands.dispatch(workspaceView, 'learn-ide:toggle-terminal', show: true)
if token?.length
confirmOauthToken(token).then (res) ->
console.log "res: #{res}"
return unless res
atom.config.set('integrated-learn-environment.oauthToken', token)
atom.config.set('integrated-learn-environment.vm_port', res.vm_uid)
atom.commands.dispatch(workspaceView, 'learn-ide:toggle-terminal', show: true)
if newURL.match(/github_sign_in/)
win.destroy()
githubLogin()
Expand Down
4 changes: 2 additions & 2 deletions lib/models/browser-window-wrapper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BrowserWindowWrapper

@win = new BrowserWindow(options)
@webContents = @win.webContents
forceBrowserWindowOptions(@win, options)
@forceBrowserWindowOptions(@win, options)

@handleEvents()
@win.loadUrl(url) # TODO: handle failed load
Expand All @@ -28,7 +28,7 @@ class BrowserWindowWrapper
@win.destroy()
shell.openExternal(url)

forceBrowserWindowConfigurations: (win, options) ->
forceBrowserWindowOptions: (win, options) ->
# these options fail as arguments to the BrowserWindor constructor
{skipTaskbar, menuBarVisible, title} = options

Expand Down

0 comments on commit d121dd5

Please sign in to comment.