Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import SessionService from 'ember-simple-auth/services/session';
import {computed} from '@ember/object';
import {inject as service} from '@ember/service';
export default SessionService.extend({
dataStore: service('store'), // SessionService.store already exists
user: computed(function () {
return this.dataStore.queryRecord('user', {id: 'me'});
}),
authenticate() {
// ensure any cached this.user value is removed and re-fetched
this.notifyPropertyChange('user');
return this._super(...arguments);
}
});
import ESASession from 'ember-simple-auth/services/session';
export default ESASession.extend();
import Session from 'ember-simple-auth/services/session';
import { get, set, computed, getProperties } from '@ember/object';
import { isPresent } from '@ember/utils';
import { inject as service } from '@ember/service';
import { run } from '@ember/runloop';
import DS from 'ember-data';
import jQuery from 'jquery';
export default Session.extend({
store: service(),
raven: service(),
error: null,
hasUser: computed('isAuthenticated', 'account', function() {
return get(this, 'isAuthenticated') && isPresent(get(this, 'account'));
}).readOnly(),
authenticateWithOAuth2(identification, password) {
return this.authenticate('authenticator:oauth2', identification, password);
},
authenticateWithFacebook() {
return this.authenticate('authenticator:assertion', 'facebook');
},