mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
cf7a763199
refs https://github.com/TryGhost/Admin/pull/1901 Ember has deprecated mixins in preparation for 4.0 and `ember-simple-auth` has now done the same in 3.1.0. - removed all imports of Ember Simple Auth mixins - moved authenticated and invalidated handling from application route to session service - moved server-notification loading from application route to session service - updated `AuthenticatedRoute` to use the session service directly rather than authenticated route mixin - added `UnauthenticatedRoute` that incorporates the behaviour from our overridden `UnauthenticatedRouteMixin` and switches to using the session service directly
26 lines
747 B
JavaScript
26 lines
747 B
JavaScript
import UnauthenticatedRoute from 'ghost-admin/routes/unauthenticated';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default UnauthenticatedRoute.extend({
|
|
notifications: service(),
|
|
session: service(),
|
|
|
|
beforeModel() {
|
|
if (this.get('session.isAuthenticated')) {
|
|
this.notifications.showAlert('You can\'t reset your password while you\'re signed in.', {type: 'warn', delayed: true, key: 'password.reset.signed-in'});
|
|
}
|
|
|
|
this._super(...arguments);
|
|
},
|
|
|
|
setupController(controller, params) {
|
|
controller.token = params.token;
|
|
},
|
|
|
|
// Clear out any sensitive information
|
|
deactivate() {
|
|
this._super(...arguments);
|
|
this.controller.clearData();
|
|
}
|
|
});
|