This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/not-activated.js.es6
Robin Ward 40ab2e5667 FEATURE: Let users update their emails before confirming
This allows users who entered a typo or invalid email address when
signing up an opportunity to fix it and resending the confirmation
email to that address.
2017-04-05 16:44:49 -04:00

27 lines
921 B
JavaScript

import { ajax } from 'discourse/lib/ajax';
import { popupAjaxError } from 'discourse/lib/ajax-error';
import ModalFunctionality from 'discourse/mixins/modal-functionality';
import { userPath } from 'discourse/lib/url';
export default Ember.Controller.extend(ModalFunctionality, {
actions: {
sendActivationEmail() {
ajax(userPath('action/send_activation_email'), {
data: { username: this.get('username') },
type: 'POST'
}).then(() => {
const modal = this.showModal('activation-resent', {title: 'log_in'});
modal.set('currentEmail', this.get('currentEmail'));
}).catch(popupAjaxError);
},
editActivationEmail() {
const modal = this.showModal('activation-edit', {title: 'login.change_email'});
const currentEmail = this.get('currentEmail');
modal.set('currentEmail', currentEmail);
modal.set('newEmail', currentEmail);
}
}
});