8752ba8657ed15af53718a81569bee71d8d96c35
8 "register": "/register",
12 "login": "Connection token sent. Check your emails!",
13 "register": "Registration complete! Please check your emails.",
16 const animationDuration
= 300; //in milliseconds
18 // Basic anti-bot measure: force at least N seconds between arrival on page, and register form validation:
19 const enterTime
= Date
.now();
29 stage: "login", //or "register"
32 // https://laracasts.com/discuss/channels/vue/vuejs-set-focus-on-textfield
33 this.$refs
.userEmail
.focus();
36 toggleStage: function(stage
) {
37 let $form
= $("#form");
38 $form
.fadeOut(animationDuration
);
42 }, animationDuration
);
45 if (this.stage
=="register")
47 if (Date
.now() - enterTime
< 5000)
50 let error
= Validator
.checkObject({email: this.user
.email
}, "User");
51 if (!error
&& this.stage
== "register")
52 error
= Validator
.checkObject({name: this.user
.name
}, "User");
53 let $dialog
= $("#dialog");
55 setTimeout(() => {hide($dialog
);}, 3000);
57 return showMsg($dialog
, "error", error
);
58 showMsg($dialog
, "process", "Processing... Please wait");
59 $.ajax(ajaxUrl
[this.stage
],
64 email: encodeURIComponent(this.user
.email
),
65 name: encodeURIComponent(this.user
.name
), //may be unused
71 this.user
["name"] = "";
72 this.user
["email"] = "";
73 showMsg($dialog
, "info", infos
[this.stage
]);
76 showMsg($dialog
, "error", res
.errmsg
);