fix router after_signin behaviour
This commit is contained in:
parent
dee3591147
commit
2485a7bcb9
|
@ -49,7 +49,7 @@
|
|||
@set('state', if user then 'signed-in' else 'signed-out')
|
||||
@set('user', if user then user else undefined)
|
||||
if Travis.app && (router = Travis.app.get('router'))
|
||||
router.send('authenticate')
|
||||
router.send('after_signin')
|
||||
|
||||
storeToken: (token) ->
|
||||
sessionStorage.setItem('travis.token', token)
|
||||
|
|
|
@ -147,34 +147,25 @@ Travis.Router = Ember.Router.extend
|
|||
needsAuth: (path) ->
|
||||
path.indexOf('/profile') == 0
|
||||
|
||||
authenticate: ->
|
||||
@app.get('router').transitionTo('authenticated')
|
||||
after_signin: ->
|
||||
after_signin_path = sessionStorage.getItem('travis.after_signin_path')
|
||||
sessionStorage.removeItem('travis.after_signin_path')
|
||||
@transitionTo('root')
|
||||
@route(after_signin_path || '/')
|
||||
|
||||
loading: Ember.Route.extend
|
||||
routePath: (router, path) ->
|
||||
router.saveLineNumberHash(path)
|
||||
|
||||
sessionStorage.setItem('travis.path', path)
|
||||
if !router.signedIn() && router.needsAuth(path)
|
||||
sessionStorage.setItem('travis.after_signin_path', path)
|
||||
router.transitionTo('root.auth')
|
||||
Travis.app.signIn()
|
||||
else
|
||||
router.transitionTo('authenticated')
|
||||
|
||||
authenticated: Ember.Route.extend
|
||||
authenticate: (->)
|
||||
connectOutlets: (router) ->
|
||||
path = sessionStorage.getItem('travis.path')
|
||||
sessionStorage.removeItem('travis.path')
|
||||
router.transitionTo('root')
|
||||
if path
|
||||
router.transitionTo('root')
|
||||
router.route(path)
|
||||
else
|
||||
router.route('/')
|
||||
|
||||
root: Ember.Route.extend
|
||||
route: '/'
|
||||
authenticate: (->)
|
||||
loading: Ember.State.extend()
|
||||
|
||||
auth: Ember.Route.extend
|
||||
|
|
27
assets/styles/auth.sass
Normal file
27
assets/styles/auth.sass
Normal file
|
@ -0,0 +1,27 @@
|
|||
@import "_mixins/all"
|
||||
|
||||
#auth
|
||||
#page
|
||||
display: block
|
||||
|
||||
#main
|
||||
top: 200px
|
||||
margin: 0 auto 0 auto
|
||||
padding: 25px 50px
|
||||
|
||||
width: 300px
|
||||
min-width: auto
|
||||
border: 10px solid #bbb
|
||||
@include border-radius(8px)
|
||||
|
||||
h1
|
||||
margin-bottom: 1em
|
||||
color: #333
|
||||
|
||||
p
|
||||
color: #333
|
||||
|
||||
a:hover
|
||||
text-decoration: underline
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
d8adcb7d
|
||||
26785586
|
Loading…
Reference in New Issue
Block a user