--- /dev/null
+var passwordReset = {};
+
+passwordReset.run = function run(params) {
+
+ Vue.component('message', {
+ props: ["key", ],
+ template: '#message',
+ });
+
+ var data = {
+ email: "",
+ message: "BLANK_ADDRESS",
+ state: "",
+ };
+
+ var methods = {};
+ methods.submit = function submit() {
+ this.state = "posting";
+ newslash.resetPassword(this.email).then(
+ (resp) => {
+ // ok
+ this.state = "succeed";
+ this.message = "SUCCEED";
+ },
+ (resp) => {
+ // failed
+ this.message = resp.error || "SERVER_ERROR";
+ this.state = "";
+ });
+ };
+
+ // form value validations
+ var watch = {};
+ watch.email = function watchEmail(val, oldVal) {
+ if (val.length == 0) { this.message = "BLANK_ADDRESS"; }
+ else if (val.search(/.@\w/) < 0) { this.message = "INVALID_ADDRESS"; }
+ else { this.message = ""; }
+ };
+
+ var vm = new Vue({
+ el: params.el,
+ data: data,
+ methods: methods,
+ watch: watch,
+ });
+
+};