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/routes/password-reset.js.es6
Mark VanLandingham e5311ab645 DEV: Import DiscourseRoute rather than Discourse.Route (#8225)
* DEV: Discourse.Route -> DiscourseRoute with import

* ran prettier on all routes

* prettiered one more file
2019-10-22 09:46:10 -04:00

29 lines
737 B
JavaScript

import DiscourseRoute from "discourse/routes/discourse";
import PreloadStore from "preload-store";
import { ajax } from "discourse/lib/ajax";
import { userPath } from "discourse/lib/url";
export default DiscourseRoute.extend({
titleToken() {
return I18n.t("login.reset_password");
},
model(params) {
if (PreloadStore.get("password_reset")) {
return PreloadStore.getAndRemove("password_reset").then(json =>
_.merge(params, json)
);
}
},
afterModel(model) {
// confirm token here so email clients who crawl URLs don't invalidate the link
if (model) {
return ajax({
url: userPath(`confirm-email-token/${model.token}.json`),
dataType: "json"
});
}
}
});