How to use the ember-simple-auth/services/session.extend function in ember-simple-auth

To help you get started, we’ve selected a few ember-simple-auth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TryGhost / Ghost-Admin / app / services / session.js View on Github external
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);
    }
});
github code-corps / code-corps-ember / app / services / session.js View on Github external
import ESASession from 'ember-simple-auth/services/session';

export default ESASession.extend();
github hummingbird-me / hummingbird-client / app / services / session.js View on Github external
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');
  },