2015-02-12 21:22:32 -07:00
import Ember from 'ember' ;
2015-05-13 00:27:59 -05:00
import Configuration from 'simple-auth/configuration' ;
2014-03-09 23:44:08 -04:00
import styleBody from 'ghost/mixins/style-body' ;
2015-05-25 21:10:50 -05:00
export default Ember . Route . extend ( styleBody , {
2014-03-31 11:57:50 +02:00
classNames : [ 'ghost-reset' ] ,
2014-10-24 21:09:50 +00:00
2015-05-25 21:10:50 -05:00
notifications : Ember . inject . service ( ) ,
2014-07-28 18:00:08 +02:00
beforeModel : function ( ) {
if ( this . get ( 'session' ) . isAuthenticated ) {
2015-10-07 15:44:23 +01: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' } ) ;
2015-05-13 00:27:59 -05:00
this . transitionTo ( Configuration . routeAfterAuthentication ) ;
2014-07-28 18:00:08 +02:00
}
} ,
2014-10-24 21:09:50 +00:00
2014-03-31 11:57:50 +02:00
setupController : function ( controller , params ) {
controller . token = params . token ;
2014-10-02 09:12:54 -06:00
} ,
2014-10-24 21:09:50 +00:00
2014-10-02 09:12:54 -06:00
// Clear out any sensitive information
deactivate : function ( ) {
this . _super ( ) ;
this . controller . clearData ( ) ;
2014-03-31 11:57:50 +02:00
}
2014-03-09 23:44:08 -04:00
} ) ;