This file contains hidden or 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
Ember.SimpleAuth.Authenticators.OAuth2.reopen({ | |
serverTokenEndpoint: ENV.api.host + '/' + ENV.api.namespace + '/oauth/token', | |
restore: function(properties) { | |
return new Ember.RSVP.Promise(function(resolve, reject) { | |
if (!Ember.isEmpty(properties.user_token) && | |
!Ember.isEmpty(properties.user_email) && | |
!Ember.isEmpty(properties.resource_owner_id)) { | |
resolve(properties); | |
} else { | |
reject(); |
This file contains hidden or 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
import DeviseAPIAuthenticator from 'devon-discovery/authenticators/devise_api'; | |
export default { | |
name: 'authentication', | |
initialize: function(container, application) { | |
container.register('ember-simple-auth-authenticator:devise_api', DeviseAPIAuthenticator); | |
// customize the session so that it allows access to the account object | |
Ember.SimpleAuth.Session.reopen({ | |
user: function() { |
This file contains hidden or 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
Ember.EasyForm.Select.reopen({ | |
didInsertElement: function() { | |
// Listen for select2 value changes. | |
// Uses embers helper method to make sure this is bound correctly. | |
// See: http://balinterdi.com/2014/05/09/ember-dot-run-dot-bind.html | |
this.$().select2().on("change", Ember.run.bind(this, this.select2ValueChanged)); | |
}, | |
... | |
// When select2s value changes, update the components value | |
select2ValueChanged: function(e) { |
This file contains hidden or 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
import Facebook from 'appkit/initializers/facebook'; | |
var FacebookAuthenticator = Ember.SimpleAuth.Authenticators.OAuth2.extend({ | |
authenticate: function() { | |
var _this = this; | |
return new Ember.RSVP.Promise(function(resolve, reject) { | |
FB.getLoginStatus(function(response) { | |
if (response.status === 'connected') { | |
_this.facebookCallback().then(function(response) { | |
var expiresAt = _this.absolutizeExpirationTime(response.expires_in); |
This file contains hidden or 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
var FacebookLoader = Ember.Object.create({ | |
setup: function(settings) { | |
this.loadScript().then(function(fb) { | |
console.log('in setup callabck'); | |
}); | |
}, | |
loadScript: function() { | |
return new Ember.RSVP.Promise(function(resolve) { | |
window.fbAsyncInit = function() { | |
resolve(); |
This file contains hidden or 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
Ember.SimpleAuth.Session.reopen({ | |
currentUser: function() { | |
return new Ember.RSVP.Promise(function(resolve, reject) { | |
Ember.$.ajax({ | |
url: '/api/users/current', | |
type: 'GET' | |
}).then(function(response) { | |
Ember.run(function() { | |
var user = container.lookup("store:main").pushPayload(response); | |
resolve(user); |
This file contains hidden or 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
{{#input firstName}} | |
{{input-field firstName placeholder='First Name'}} | |
<br/> | |
{{error-field firstName}} | |
{{/input}} |
This file contains hidden or 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
App.User = DS.Model.extend({ | |
gender: DS.attr('string'), | |
isFemale: function() { return this.get('gender') == 'female'; }, | |
isMale: function() { return this.get('gender') == 'male'; } | |
}); |
This file contains hidden or 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
var user = store.find('user', 'current'); | |
container.lookup('controller:currentUser').set('content', user); | |
App.inject('controller', 'currentUser', 'controller:currentUser'); |
NewerOlder