2016-06-30 13:21:47 +03:00
import Route from 'ember-route' ;
import injectService from 'ember-service/inject' ;
2017-03-14 19:04:46 +03:00
import UnauthenticatedRouteMixin from 'ghost-admin/mixins/unauthenticated-route-mixin' ;
2016-05-24 15:06:59 +03:00
import styleBody from 'ghost-admin/mixins/style-body' ;
2014-03-10 07:44:08 +04:00
2017-02-10 13:34:37 +03:00
export default Route . extend ( styleBody , UnauthenticatedRouteMixin , {
2014-03-31 13:57:50 +04:00
classNames : [ 'ghost-reset' ] ,
2014-10-25 01:09:50 +04:00
2016-06-30 13:21:47 +03:00
notifications : injectService ( ) ,
session : injectService ( ) ,
2015-05-26 05:10:50 +03:00
2015-10-28 14:36:45 +03:00
beforeModel ( ) {
2015-10-18 21:17:02 +03:00
if ( this . get ( 'session.isAuthenticated' ) ) {
2015-10-07 17:44:23 +03:00
this . get ( 'notifications' ) . showAlert ( 'You can\'t reset your password while you\'re signed in.' , { type : 'warn' , delayed : true , key : 'password.reset.signed-in' } ) ;
2014-07-28 20:00:08 +04:00
}
2017-02-10 13:34:37 +03:00
this . _super ( ... arguments ) ;
2014-07-28 20:00:08 +04:00
} ,
2014-10-25 01:09:50 +04:00
2015-10-28 14:36:45 +03:00
setupController ( controller , params ) {
2014-03-31 13:57:50 +04:00
controller . token = params . token ;
2014-10-02 19:12:54 +04:00
} ,
2014-10-25 01:09:50 +04:00
2014-10-02 19:12:54 +04:00
// Clear out any sensitive information
2015-10-28 14:36:45 +03:00
deactivate ( ) {
this . _super ( ... arguments ) ;
2014-10-02 19:12:54 +04:00
this . controller . clearData ( ) ;
2014-03-31 13:57:50 +04:00
}
2014-03-10 07:44:08 +04:00
} ) ;