fix sign in payload, user loading etc
This commit is contained in:
parent
b3c310d51d
commit
effd6360a7
|
@ -47,8 +47,7 @@ Travis.reopen
|
||||||
# $.cookie('user', JSON.stringify(data))
|
# $.cookie('user', JSON.stringify(data))
|
||||||
if data
|
if data
|
||||||
@store.load(Travis.User, data.user)
|
@store.load(Travis.User, data.user)
|
||||||
# TODO: this throws an error
|
@store.loadMany(Travis.Account, data.accounts)
|
||||||
#@store.loadMany(Travis.Account, data.accounts)
|
|
||||||
@set('currentUser', if data then Travis.User.find(data.user.id) else undefined)
|
@set('currentUser', if data then Travis.User.find(data.user.id) else undefined)
|
||||||
|
|
||||||
render: (name, action, params) ->
|
render: (name, action, params) ->
|
||||||
|
|
|
@ -6,7 +6,7 @@ require 'travis/model'
|
||||||
login: DS.attr('string')
|
login: DS.attr('string')
|
||||||
token: DS.attr('string')
|
token: DS.attr('string')
|
||||||
locale: DS.attr('string')
|
locale: DS.attr('string')
|
||||||
gravatar: DS.attr('string')
|
gravatarId: DS.attr('string')
|
||||||
isSyncing: DS.attr('boolean')
|
isSyncing: DS.attr('boolean')
|
||||||
syncedAt: DS.attr('string')
|
syncedAt: DS.attr('string')
|
||||||
repoCount: DS.attr('number')
|
repoCount: DS.attr('number')
|
||||||
|
|
|
@ -65,8 +65,8 @@
|
||||||
userBinding: 'controller.user'
|
userBinding: 'controller.user'
|
||||||
|
|
||||||
gravatarUrl: (->
|
gravatarUrl: (->
|
||||||
"http://www.gravatar.com/avatar/#{@get('user.gravatar')}?s=48&d=mm"
|
"http://www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=48&d=mm"
|
||||||
).property('user.gravatar')
|
).property('user.gravatarId')
|
||||||
|
|
||||||
locales: (->
|
locales: (->
|
||||||
[
|
[
|
||||||
|
|
|
@ -8,8 +8,8 @@ require 'travis/auth'
|
||||||
userBinding: 'controller.user'
|
userBinding: 'controller.user'
|
||||||
|
|
||||||
gravatarUrl: (->
|
gravatarUrl: (->
|
||||||
"https://www.gravatar.com/avatar/#{@get('user.gravatar')}?s=24&d=mm"
|
"https://www.gravatar.com/avatar/#{@get('user.gravatarId')}?s=24&d=mm"
|
||||||
).property('user.gravatar')
|
).property('user.gravatarId')
|
||||||
|
|
||||||
# hrm. how to parametrize bindAttr?
|
# hrm. how to parametrize bindAttr?
|
||||||
classHome: (->
|
classHome: (->
|
||||||
|
|
|
@ -15,7 +15,7 @@ $.extend Travis.Auth.prototype,
|
||||||
|
|
||||||
expectedOrigin: ->
|
expectedOrigin: ->
|
||||||
if Travis.config.api_endpoint[0] == '/'
|
if Travis.config.api_endpoint[0] == '/'
|
||||||
window.location.protocol + "://" + window.location.host
|
window.location.protocol + "//" + window.location.host
|
||||||
else
|
else
|
||||||
Travis.config.api_endpoint
|
Travis.config.api_endpoint
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ $.extend Travis.Auth.prototype,
|
||||||
console.log("unexpected message #{event.origin}: #{event.data}")
|
console.log("unexpected message #{event.origin}: #{event.data}")
|
||||||
else
|
else
|
||||||
Travis.config.access_token = event.data.token
|
Travis.config.access_token = event.data.token
|
||||||
Travis.app.setCurrentUser(event.data.user)
|
Travis.app.setCurrentUser(event.data)
|
||||||
console.log('sign in!')
|
console.log("signed in as #{event.data.user.login}")
|
||||||
|
|
||||||
trySignIn: ->
|
trySignIn: ->
|
||||||
@iframe.attr('src', "#{Travis.config.api_endpoint}/auth/post_message")
|
@iframe.attr('src', "#{Travis.config.api_endpoint}/auth/post_message")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user