change-form.js 659 B

12345678910111213141516171819202122232425
  1. import Ember from 'ember';
  2. import ResetScroll from 'misago/mixins/reset-scroll';
  3. import rpc from 'misago/utils/rpc';
  4. export default Ember.Route.extend(ResetScroll, {
  5. model: function(params) {
  6. return rpc('change-password/' + params.user_id + '/' + params.token + '/validate-token/');
  7. },
  8. actions: {
  9. didTransition: function() {
  10. this.send('setTitle', gettext('Change forgotten password'));
  11. return true;
  12. },
  13. error: function(reason) {
  14. if (reason.status === 404) {
  15. this.get('toast').error(reason.responseJSON.detail);
  16. return this.transitionTo('forgotten-password');
  17. }
  18. return true;
  19. }
  20. }
  21. });