mirror of
https://github.com/TryGhost/Ghost-Admin.git
synced 2023-12-14 02:33:04 +01:00
92107312a8
no issue - update imports for `@ember-data` package (https://github.com/emberjs/rfcs/blob/master/text/0395-ember-data-packages.md) - use `computed.reads` where applicable (https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/require-computed-macros.md) - fix usage of `scheduleOnce` so that functions are only scheduled once (https://github.com/ember-cli/eslint-plugin-ember/blob/master/docs/rules/no-incorrect-calls-with-inline-anonymous-functions.md)
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
// TODO: remove usage of Ember Data's private `Errors` class when refactoring validations
|
|
// eslint-disable-next-line
|
|
import DS from 'ember-data';
|
|
import EmberObject from '@ember/object';
|
|
import Route from '@ember/routing/route';
|
|
import UnauthenticatedRouteMixin from 'ghost-admin/mixins/unauthenticated-route-mixin';
|
|
|
|
const {Errors} = DS;
|
|
|
|
const defaultModel = function defaultModel() {
|
|
return EmberObject.create({
|
|
identification: '',
|
|
password: '',
|
|
errors: Errors.create()
|
|
});
|
|
};
|
|
|
|
export default Route.extend(UnauthenticatedRouteMixin, {
|
|
model() {
|
|
return defaultModel();
|
|
},
|
|
|
|
// the deactivate hook is called after a route has been exited.
|
|
deactivate() {
|
|
let controller = this.controllerFor('signin');
|
|
|
|
this._super(...arguments);
|
|
|
|
// clear the properties that hold the credentials when we're no longer on the signin screen
|
|
controller.set('signin', defaultModel());
|
|
},
|
|
|
|
buildRouteInfoMetadata() {
|
|
return {
|
|
titleToken: 'Sign In',
|
|
bodyClasses: ['unauthenticated-route']
|
|
};
|
|
}
|
|
});
|