add auth timeout

This commit is contained in:
Konstantin Haase 2012-09-18 20:38:19 +02:00
parent 5f8c5f5798
commit f3f9d98e6b
3 changed files with 10 additions and 3 deletions

View File

@ -22,7 +22,7 @@ GIT
GIT
remote: git://github.com/travis-ci/travis-api.git
revision: 1e903129a31ab7785e17562740d0bfb69486e2f3
revision: 1a7a9daf4643abf6c954bf26c63816783ded9bda
branch: sf-use-services
specs:
travis-api (0.0.1)

View File

@ -30,6 +30,13 @@ $.extend Travis.Auth.prototype,
trySignIn: ->
@iframe.attr('src', "#{Travis.config.api_endpoint}/auth/post_message")
newUser: ->
url = "#{Travis.config.api_endpoint}/auth/handshake?redirect_uri=#{window.location}"
window.location = url
checkUser: ->
@newUser() unless Travis.config.access_token?
signIn: ->
@trySignIn()
# TODO: timeout for redirect goes here
window.setTimeout((=> @checkUser()), 15000)

File diff suppressed because one or more lines are too long