refactor user password change
This commit is contained in:
parent
1dd0910ed1
commit
45703e67ee
5 changed files with 107 additions and 45 deletions
|
@ -1,16 +1,19 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
export default Ember.Route.extend({
|
||||
currentUser: Ember.inject.service('session-account'),
|
||||
const { Route, inject: { service } } = Ember;
|
||||
|
||||
export default Route.extend({
|
||||
currentUser: service('session-account'),
|
||||
|
||||
beforeModel: function(transition) {
|
||||
this._super(transition);
|
||||
|
||||
let user_id = transition.params['protected.users.changepassword'].user_id;
|
||||
// Only the logged in user can change their password
|
||||
const user_id = transition.params['protected.users.changepassword'].user_id;
|
||||
|
||||
this.get('currentUser.account').then((user) => {
|
||||
if (user.get('id') !== user_id) {
|
||||
this.transitionTo('protected.users.index');
|
||||
this.transitionTo('protected.users.show', user.get('id'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Reference in a new issue