diff --git a/app/assets/javascripts/discourse/app/components/activation-email-form.gjs b/app/assets/javascripts/discourse/app/components/activation-email-form.gjs
new file mode 100644
index 00000000000..01c672e7dfb
--- /dev/null
+++ b/app/assets/javascripts/discourse/app/components/activation-email-form.gjs
@@ -0,0 +1,21 @@
+import Component from "@glimmer/component";
+import { on } from "@ember/modifier";
+import { action } from "@ember/object";
+import i18n from "discourse-common/helpers/i18n";
+
+export default class ActivationEmailForm extends Component {
+ @action
+ newEmailChanged(event) {
+ this.args.updateNewEmail(event.target.value);
+ }
+
+
+ {{i18n "login.provide_new_email"}}
{{i18n "login.provide_new_email"}}
- \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/activation-email-form.js b/app/assets/javascripts/discourse/app/components/activation-email-form.js deleted file mode 100644 index f4f958c898a..00000000000 --- a/app/assets/javascripts/discourse/app/components/activation-email-form.js +++ /dev/null @@ -1,9 +0,0 @@ -import Component from "@glimmer/component"; -import { action } from "@ember/object"; - -export default class ActivationEmailForm extends Component { - @action - newEmailChanged(value) { - this.args.updateNewEmail?.(value); - } -} diff --git a/app/assets/javascripts/discourse/app/components/modal/activation-edit.js b/app/assets/javascripts/discourse/app/components/modal/activation-edit.js index 5568a192668..2b4fdce5c01 100644 --- a/app/assets/javascripts/discourse/app/components/modal/activation-edit.js +++ b/app/assets/javascripts/discourse/app/components/modal/activation-edit.js @@ -23,11 +23,11 @@ export default class ActivationEdit extends Component { await changeEmail({ username: this.login?.loginName, password: this.login?.loginPassword, - email: this.args.model.newEmail, + email: this.newEmail, }); this.modal.show(ActivationResent, { - model: { currentEmail: this.args.model.newEmail }, + model: { currentEmail: this.newEmail }, }); } catch (e) { this.flash = extractError(e); @@ -35,7 +35,7 @@ export default class ActivationEdit extends Component { } @action - updateNewEmail(e) { - this.newEmail = e.target.value; + updateNewEmail(email) { + this.newEmail = email; } } diff --git a/app/assets/javascripts/discourse/app/controllers/account-created-edit-email.js b/app/assets/javascripts/discourse/app/controllers/account-created-edit-email.js index 0365f07441d..4280f2fdde3 100644 --- a/app/assets/javascripts/discourse/app/controllers/account-created-edit-email.js +++ b/app/assets/javascripts/discourse/app/controllers/account-created-edit-email.js @@ -1,4 +1,5 @@ import Controller from "@ember/controller"; +import { action } from "@ember/object"; import { inject as service } from "@ember/service"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { changeEmail } from "discourse/lib/user-activation"; @@ -6,6 +7,7 @@ import discourseComputed from "discourse-common/utils/decorators"; export default Controller.extend({ router: service(), + accountCreated: null, newEmail: null, @@ -14,19 +16,25 @@ export default Controller.extend({ return newEmail === currentEmail; }, - actions: { - changeEmail() { - const email = this.newEmail; - changeEmail({ email }) - .then(() => { - this.set("accountCreated.email", email); - this.router.transitionTo("account-created.resent"); - }) - .catch(popupAjaxError); - }, + @action + updateNewEmail(email) { + this.set("newEmail", email); + }, - cancel() { - this.router.transitionTo("account-created.index"); - }, + @action + async changeEmail() { + try { + await changeEmail({ email: this.newEmail }); + + this.set("accountCreated.email", this.newEmail); + this.router.transitionTo("account-created.resent"); + } catch (e) { + popupAjaxError(e); + } + }, + + @action + cancel() { + this.router.transitionTo("account-created.index"); }, }); diff --git a/app/assets/javascripts/discourse/app/templates/account-created/edit-email.hbs b/app/assets/javascripts/discourse/app/templates/account-created/edit-email.hbs index 3630068b740..396cf1b5797 100644 --- a/app/assets/javascripts/discourse/app/templates/account-created/edit-email.hbs +++ b/app/assets/javascripts/discourse/app/templates/account-created/edit-email.hbs @@ -1,13 +1,16 @@