mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
more ember-simple-auth UnauthenticatedRoute cleanup (#44)
no issue - aligns routes that require the user to be logged out with the ember-simple-auth method of doing things
This commit is contained in:
parent
fbc99e6fa7
commit
bb007ec84f
@ -1,20 +1,20 @@
|
||||
import Route from 'ember-route';
|
||||
import injectService from 'ember-service/inject';
|
||||
import Configuration from 'ember-simple-auth/configuration';
|
||||
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
|
||||
import styleBody from 'ghost-admin/mixins/style-body';
|
||||
|
||||
export default Route.extend(styleBody, {
|
||||
export default Route.extend(styleBody, UnauthenticatedRouteMixin, {
|
||||
classNames: ['ghost-reset'],
|
||||
|
||||
notifications: injectService(),
|
||||
session: injectService(),
|
||||
|
||||
beforeModel() {
|
||||
this._super(...arguments);
|
||||
if (this.get('session.isAuthenticated')) {
|
||||
this.get('notifications').showAlert('You can\'t reset your password while you\'re signed in.', {type: 'warn', delayed: true, key: 'password.reset.signed-in'});
|
||||
this.transitionTo(Configuration.routeAfterAuthentication);
|
||||
}
|
||||
|
||||
this._super(...arguments);
|
||||
},
|
||||
|
||||
setupController(controller, params) {
|
||||
|
@ -9,13 +9,13 @@ import {
|
||||
} from 'ghost-admin/services/ajax';
|
||||
|
||||
import DS from 'ember-data';
|
||||
import Configuration from 'ember-simple-auth/configuration';
|
||||
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
|
||||
import styleBody from 'ghost-admin/mixins/style-body';
|
||||
|
||||
const {Promise} = RSVP;
|
||||
const {Errors} = DS;
|
||||
|
||||
export default Route.extend(styleBody, {
|
||||
export default Route.extend(styleBody, UnauthenticatedRouteMixin, {
|
||||
classNames: ['ghost-signup'],
|
||||
|
||||
ghostPaths: injectService(),
|
||||
@ -24,12 +24,11 @@ export default Route.extend(styleBody, {
|
||||
ajax: injectService(),
|
||||
|
||||
beforeModel() {
|
||||
this._super(...arguments);
|
||||
|
||||
if (this.get('session.isAuthenticated')) {
|
||||
this.get('notifications').showAlert('You need to sign out to register as a new user.', {type: 'warn', delayed: true, key: 'signup.create.already-authenticated'});
|
||||
this.transitionTo(Configuration.routeIfAlreadyAuthenticated);
|
||||
}
|
||||
|
||||
this._super(...arguments);
|
||||
},
|
||||
|
||||
model(params) {
|
||||
|
Loading…
Reference in New Issue
Block a user