Don't trigger state change on signin if already in authenticated state

This commit is contained in:
Piotr Sarnacki 2012-10-09 13:08:57 +02:00
parent 9237770180
commit 64fc6ce717
7 changed files with 1463 additions and 1657 deletions

View File

@ -43,7 +43,7 @@ GIT
GIT
remote: git://github.com/travis-ci/travis-api.git
revision: 5d9c867142162b20d8471530f7447bd4af93c0e4
revision: 1624742cfd4bb1704ef916684e8962bf25219de3
specs:
travis-api (0.0.1)
backports (~> 2.5)

View File

@ -48,8 +48,8 @@
user = @storeUser(data.user) if data?.user
@set('state', if user then 'signed-in' else 'signed-out')
@set('user', if user then user else undefined)
@app.get('router').transitionTo('authenticated') if @app.get('router')
# Travis.app.get('router').route(@get('returnTo'))
if Travis.app && (router = Travis.app.get('router'))
router.send('authenticate')
storeToken: (token) ->
sessionStorage.setItem('travis.token', token)

View File

@ -134,12 +134,14 @@ Travis.Router = Ember.Router.extend
needsAuth: (path) ->
path.indexOf('/profile') == 0 && !@signedIn()
authenticate: ->
@app.get('router').transitionTo('authenticated')
loading: Ember.Route.extend
routePath: (router, path) ->
if match = path.match(/#.*$/)
router.set 'lineNumberHash', match[0]
sessionStorage.setItem('travis.path', path)
if router.needsAuth(path)
router.transitionTo('root.auth')
@ -148,6 +150,7 @@ Travis.Router = Ember.Router.extend
router.transitionTo('authenticated')
authenticated: Ember.Route.extend
authenticate: Ember.K
connectOutlets: (router) ->
path = sessionStorage.getItem('travis.path')
sessionStorage.removeItem('travis.path')
@ -158,6 +161,7 @@ Travis.Router = Ember.Router.extend
router.route('/')
root: Ember.Route.extend
authenticate: Ember.K
loading: Ember.State.extend()
auth: Ember.Route.extend

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
3c986040
095a1a79