activate.js 689 B

1234567891011121314151617181920212223242526272829
  1. import MisagoRoute from 'misago/routes/misago';
  2. export default MisagoRoute.extend({
  3. model: function(params) {
  4. return this.ajax.post('auth/activate-account/' + params.user_id + '/' + params.token);
  5. },
  6. afterModel: function(model) {
  7. this.modal.show('login');
  8. this.toast.success(model.detail);
  9. return this.transitionTo('index');
  10. },
  11. actions: {
  12. loading: function() {
  13. this.set('title', gettext('Activating account...'));
  14. return true;
  15. },
  16. error: function(reason) {
  17. if (reason.status === 400) {
  18. this.toast.error(reason.responseJSON.detail);
  19. return this.transitionTo('activation');
  20. }
  21. return true;
  22. }
  23. }
  24. });