projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add debug traces
[vchess.git]
/
client
/
src
/
components
/
UpsertUser.vue
diff --git
a/client/src/components/UpsertUser.vue
b/client/src/components/UpsertUser.vue
index
46f3bfe
..
8d0b736
100644
(file)
--- a/
client/src/components/UpsertUser.vue
+++ b/
client/src/components/UpsertUser.vue
@@
-26,7
+26,7
@@
div
i.material-icons send
button(v-if="stage!='Update'" @click="toggleStage()")
span {{ stage=="Login" ? "Register" : "Login" }}
i.material-icons send
button(v-if="stage!='Update'" @click="toggleStage()")
span {{ stage=="Login" ? "Register" : "Login" }}
- button(v-else
onClick="location.replace('/logout'
)")
+ button(v-else
@click="doLogout(
)")
span Logout
#dialog(:style="{display: displayInfo}") {{ infoMsg }}
</template>
span Logout
#dialog(:style="{display: displayInfo}") {{ infoMsg }}
</template>
@@
-39,9
+39,9
@@
export default {
name: 'my-upsert-user',
data: function() {
return {
name: 'my-upsert-user',
data: function() {
return {
- user:
Object.assign({}, store.state.user)
,
+ user:
store.state.user
,
nameOrEmail: "", //for login
nameOrEmail: "", //for login
- stage: (store.state.user.id > 0 ? "Update" : "Login"), //TODO?
+ logStage: "Login", //or Register
infoMsg: "",
enterTime: Number.MAX_SAFE_INTEGER, //for a basic anti-bot strategy
};
infoMsg: "",
enterTime: Number.MAX_SAFE_INTEGER, //for a basic anti-bot strategy
};
@@
-61,6
+61,9
@@
export default {
displayInfo: function() {
return (this.infoMsg.length > 0 ? "block" : "none");
},
displayInfo: function() {
return (this.infoMsg.length > 0 ? "block" : "none");
},
+ stage: function() {
+ return this.user.id > 0 ? "Update" : this.logStage;
+ },
},
methods: {
trySetEnterTime: function(event) {
},
methods: {
trySetEnterTime: function(event) {
@@
-69,7
+72,7
@@
export default {
},
toggleStage: function() {
// Loop login <--> register (update is for logged-in users)
},
toggleStage: function() {
// Loop login <--> register (update is for logged-in users)
- this.
stage = (this.s
tage == "Login" ? "Register" : "Login");
+ this.
logStage = (this.logS
tage == "Login" ? "Register" : "Login");
},
ajaxUrl: function() {
switch (this.stage)
},
ajaxUrl: function() {
switch (this.stage)
@@
-137,6
+140,18
@@
export default {
}
);
},
}
);
},
+ doLogout: function() {
+ ajax(
+ "/logout",
+ "GET",
+ () => {
+ this.user.id = 0;
+ this.user.name = "";
+ this.user.email = "";
+ this.user.notify = false;
+ }
+ );
+ },
},
};
</script>
},
};
</script>