-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mwalsh/social signup #95
Merged
Merged
Changes from 36 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
77222d3
Move third-party user creation to session
walsh9 b3433ad
Update tests
walsh9 c9d6248
display flash messages in account-wrapper template
walsh9 957bc77
update package.json
walsh9 f14fdb8
Update current user service
walsh9 13d0672
Update package.json
walsh9 d413b25
update package.json
walsh9 8a8d39b
Add unit test for session service
walsh9 5628015
Test that user is loaded
walsh9 9f90705
Make sure new user is loaded
walsh9 1a22bec
Flash message tweaks
walsh9 fb09cd2
Make sure avatar stays in circle
walsh9 694a88d
Update flash message margins on loading template
walsh9 92cb766
remove flashmessage from profile (in sitechrome now)
walsh9 099f9c7
Update tests to check avatar
walsh9 2d86c33
don't import avatar from facebook if it's the default silhouette
walsh9 c8fff4b
Move social user creation to provider and authenticator
walsh9 d6b89d4
Update acceptance tests for social login and signup
walsh9 d0a0a03
update current user service
walsh9 e188ac3
update tests
walsh9 0b93cfb
Mark new social users
walsh9 198822f
Get token from correct place
walsh9 67639df
Update tests
walsh9 09963f3
don't need to create user in provider
walsh9 33573cb
Update tests
walsh9 0c9788f
update package.json
walsh9 38be4d2
Remove unused service injection
walsh9 fd92a7c
Remove console log
walsh9 0b63a3e
Remove old comment
walsh9 bb3557e
Update tests
walsh9 65cac76
update package.json
walsh9 92d2487
Add decamelize keys helper
walsh9 47845fd
Un-nest promises
walsh9 880a7d8
Let ember handle user promise resolution
walsh9 93ca367
Remove duplicate dependencies
walsh9 328b0d6
Don't need these
walsh9 ff74e49
use master for nypr-account settings
walsh9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,37 @@ | ||
import Torii from 'ember-simple-auth/authenticators/torii'; | ||
import service from 'ember-service/inject'; | ||
import fetch from 'fetch'; | ||
import RSVP from 'rsvp'; | ||
import config from 'wnyc-web-client/config/environment'; | ||
import { decamelizeKeys } from 'wnyc-web-client/helpers/decamelize-keys'; | ||
|
||
export default Torii.extend({ | ||
torii: service(), | ||
|
||
authenticate() { | ||
return this._super(...arguments).then(data => { | ||
return { | ||
access_token: data.accessToken, | ||
provider: data.provider, | ||
expires_in: data.expiresIn, | ||
user_id: data.userId | ||
}; | ||
return this._super(...arguments) | ||
.then((data) => { | ||
return RSVP.all([ | ||
data, | ||
this.getSession(data.provider, data.accessToken) | ||
]); | ||
}) | ||
.then(([data, response]) => { | ||
if (response && response.ok) { | ||
return decamelizeKeys([data]); | ||
} else { | ||
return RSVP.reject(response); | ||
} | ||
}); | ||
}, | ||
|
||
getSession(provider, accessToken) { | ||
return fetch(`${config.wnycAuthAPI}/v1/session`, { | ||
method: 'GET', | ||
headers: { | ||
'Authorization': `Bearer ${accessToken}`, | ||
'X-Provider': provider | ||
} | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Ember from 'ember'; | ||
|
||
export function decamelizeKeys([ source ]/*, hash*/) { | ||
let dest = {}; | ||
Object.keys(source).forEach(k => dest[k.decamelize()] = source[k]); | ||
return dest; | ||
} | ||
|
||
export default Ember.Helper.helper(decamelizeKeys); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this hash? should it be removed before merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after merging nypublicradio/nypr-account-settings#8 i should be able to remove the hash and this and nypublicradio/wqxr-web-client#73 can be merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nypublicradio/nypr-account-settings#8 looks like it's good to merge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah was just waiting for this to be ready so I can merge them around the same time. I can start now.