0.5.0 • Published 9 years ago

ember-authenticate-me v0.5.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Ember-authenticate-me

This addon hooks Torii up to work out of the box with the Rails gem token-authenticate-me and includes some default templates, routes, and controllers.

Installation (requires ember-cli 2.11.0 or greater and ember-cli-htmlbars 1.1.1 or greater)

In your app's root Ember directory (typically app-ember), run:

  • ember install ember-authenticate-me

ember g ember-authenticate-me adds to your app/router.js router map:

this.route('login');
this.route('logout');
this.route('sign-up');
this.route('forgot-password');

this.route('reset-password', {
  path: '/reset-password/:token'
});

this.route('edit-account', {
  path: '/edit-account/:user_id'
});

Include Default CSS Styling

To include default css styling, add the following to your ember-cli projects Brocfile.js:

var app = new EmberApp({
  emberAuthenticateMe: {
      importCSS: true
    },
  ...
]);

Override default login transitions

override the app/controllers/login.js controller to:

import LoginController from 'ember-authenticate-me/controllers/login';

export default LoginController.extend({
  transitionRoute: /* route name here, I.E. 'foo' */

  transitionToLoggedInRoute: function(sessionContent) {
    /*
     * Or to dynamically control the transition
     * implement this function here and manually
     * call `this.transitionToRoute(...);
     */
  }
});

Watching session lifecycle events

An example on adding user context to sentry. app/instance-initializers/sentry.js

export function initialize(applicationInstance) {
  const sessionLifecycle = applicationInstance.lookup('service:session-lifecycle');

  sessionLifecycle.registerLoginCallback((session) => {
    if (!Ember.isBlank(session.currentUser)) {
      Raven.setUserContext({ email: session.currentUser.get('email'), id: session.currentUser.get('id') });
    }
  });

  sessionLifecycle.registerLogoutCallback((session) => {
    Raven.setUserContext();
  });
}

For more information on using ember-cli, visit http://www.ember-cli.com/.


Code Of Conduct

Wildland Open Source Code Of Conduct

0.8.1

7 years ago

0.5.0

9 years ago

0.4.0

9 years ago

0.2.0

9 years ago

0.1.0

10 years ago

0.0.19

10 years ago

0.0.18

10 years ago

0.0.17

10 years ago

0.0.16

10 years ago

0.0.15

10 years ago

0.0.14

10 years ago

0.0.13

10 years ago

0.0.12

10 years ago

0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago