import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';

This mixin is used to make routes accessible only if the session is not authenticated (e.g., login and registration routes). It defines a beforeModel method that aborts the current transition and instead transitions to the routeIfAlreadyAuthenticated if the session is authenticated.

// app/routes/login.js
          import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
          
          export default Ember.Route.extend(UnauthenticatedRouteMixin);
          

Methods

source public

beforeModel(transition)

Checks whether the session is authenticated and if it is aborts the current transition and instead transitions to the routeIfAlreadyAuthenticated.

If beforeModel is overridden in a route that uses this mixin, the route's implementation must call this._super(...arguments) so that the mixin's beforeModel method is actually executed.

Arguments

transition: Transition

The transition that lead to this route

Properties

source public

routeIfAlreadyAuthenticated: String

Default: 'index'

The route to transition to if a route that implements the UnauthenticatedRouteMixin is accessed when the session is authenticated.

source public readonly

session: SessionService

The session service.

Extends

Ember.Mixin

Methods