Вот что я сделал в конце:
приложение/сессий/custom.js
import Ember from 'ember';
import DS from 'ember-data';
import Session from 'simple-auth/session';
export default Session.extend({
currentUser: function() {
var userId = this.get('secure.userId');
if (!Ember.isEmpty(userId)) {
return DS.PromiseObject.create({
promise: this.container.lookup('store:main').find('user', userId)
});
}
}.property('secure.userId'),
// Update the session email when the user successfully changes their email.
updateEmail: Ember.observer('currentUser.email', function() {
var currentUserEmail = this.get('currentUser.email'),
sessionEmail = this.get('secure.email');
if(currentUserEmail && !this.get('currentUser.isDirty') && sessionEmail !== currentUserEmail) {
this.set('secure.email', currentUserEmail);
this.set('email', currentUserEmail);
}
}),
});
Кажется, что UpdateStore на сессии не будет вызвана, когда вы установите «secure.email» но он вызван, когда вы устанавливаете «электронную почту», однако просто установить «email» недостаточно, потому что updateStore использует «secure.email» для сохранения данных (токен &).