Ghost/ghost/admin/app/routes/reset.js
Kevin Ansfield cf7a763199 Removed usage of deprecated EmberSimpleAuth mixins (#1910)
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
2021-04-12 13:21:57 +01:00

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();
}
});