data: function() {
return {
nameOrEmail: "", //for login
logStage: "Login", //or Register
infoMsg: "",
enterTime: Number.MAX_SAFE_INTEGER, //for a basic anti-bot strategy
data: function() {
return {
nameOrEmail: "", //for login
logStage: "Login", //or Register
infoMsg: "",
enterTime: Number.MAX_SAFE_INTEGER, //for a basic anti-bot strategy
this.infoMsg = "";
this.enterTime = Date.now();
}
},
toggleStage: function() {
// Loop login <--> register (update is for logged-in users)
this.infoMsg = "";
this.enterTime = Date.now();
}
},
toggleStage: function() {
// Loop login <--> register (update is for logged-in users)
- if (this.stage == 'Login')
- {
- const type = (this.nameOrEmail.indexOf('@') >= 0 ? "email" : "name");
- error = checkNameEmail({[type]: this.nameOrEmail});
+ if (this.stage == "Login") {
+ const type = this.nameOrEmail.indexOf("@") >= 0 ? "email" : "name";
+ error = checkNameEmail({ [type]: this.nameOrEmail });
+ } else error = checkNameEmail(this.st.user);
+ if (error) {
+ alert(error);
+ return;
- ajax(this.ajaxUrl(), this.ajaxMethod(),
- this.stage == "Login" ? { nameOrEmail: this.nameOrEmail } : this.st.user,
- res => {
+ ajax(
+ this.ajaxUrl(),
+ this.ajaxMethod(),
+ this.stage == "Login"
+ ? { nameOrEmail: this.nameOrEmail }
+ : this.st.user,
+ () => {