projects
/
vchess.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
23ecf00
)
Fixes
author
Benjamin Auder
<benjamin.auder@somewhere>
Sat, 29 Feb 2020 16:43:51 +0000
(17:43 +0100)
committer
Benjamin Auder
<benjamin.auder@somewhere>
Sat, 29 Feb 2020 16:43:51 +0000
(17:43 +0100)
client/src/components/UpsertUser.vue
patch
|
blob
|
blame
|
history
client/src/views/Game.vue
patch
|
blob
|
blame
|
history
client/src/views/Hall.vue
patch
|
blob
|
blame
|
history
client/src/views/Problems.vue
patch
|
blob
|
blame
|
history
client/src/views/Variants.vue
patch
|
blob
|
blame
|
history
server/utils/access.js
patch
|
blob
|
blame
|
history
diff --git
a/client/src/components/UpsertUser.vue
b/client/src/components/UpsertUser.vue
index
50b702d
..
ac15324
100644
(file)
--- a/
client/src/components/UpsertUser.vue
+++ b/
client/src/components/UpsertUser.vue
@@
-14,22
+14,22
@@
div
div(@keyup.enter="onSubmit()")
div(v-show="stage!='Login'")
fieldset
div(@keyup.enter="onSubmit()")
div(v-show="stage!='Login'")
fieldset
- label(for="username") {{ st.tr["User name"] }}
- input#username(
+ label(for="u
_u
sername") {{ st.tr["User name"] }}
+ input#u
_u
sername(
type="text"
type="text"
- v-model="
st.
user.name"
+ v-model="user.name"
)
fieldset
)
fieldset
- label(for="useremail") {{ st.tr["Email"] }}
- input#useremail(
+ label(for="u
_u
seremail") {{ st.tr["Email"] }}
+ input#u
_u
seremail(
type="email"
type="email"
- v-model="
st.
user.email"
+ v-model="user.email"
)
fieldset
label(for="notifyNew") {{ st.tr["Notifications by email"] }}
input#notifyNew(
type="checkbox"
)
fieldset
label(for="notifyNew") {{ st.tr["Notifications by email"] }}
input#notifyNew(
type="checkbox"
- v-model="
st.
user.notify"
+ v-model="user.notify"
)
div(v-show="stage=='Login'")
fieldset
)
div(v-show="stage=='Login'")
fieldset
@@
-67,17
+67,18
@@
export default {
logStage: "Login", //or Register
infoMsg: "",
enterTime: Number.MAX_SAFE_INTEGER, //for a basic anti-bot strategy
logStage: "Login", //or Register
infoMsg: "",
enterTime: Number.MAX_SAFE_INTEGER, //for a basic anti-bot strategy
- st: store.state
+ st: store.state,
+ user: {}
};
},
watch: {
nameOrEmail: function(newValue) {
if (newValue.indexOf("@") >= 0) {
};
},
watch: {
nameOrEmail: function(newValue) {
if (newValue.indexOf("@") >= 0) {
- this.
st.
user.email = newValue;
- this.
st.
user.name = "";
+ this.user.email = newValue;
+ this.user.name = "";
} else {
} else {
- this.
st.
user.name = newValue;
- this.
st.
user.email = "";
+ this.user.name = newValue;
+ this.user.email = "";
}
}
},
}
}
},
@@
-102,6
+103,12
@@
export default {
if (event.target.checked) {
this.infoMsg = "";
this.enterTime = Date.now();
if (event.target.checked) {
this.infoMsg = "";
this.enterTime = Date.now();
+ document.getElementById("u_username").focus();
+ this.user = {
+ name: this.st.user.name,
+ email: this.st.user.email,
+ notify: this.st.user.notify
+ };
}
},
toggleStage: function() {
}
},
toggleStage: function() {
@@
-149,7
+156,7
@@
export default {
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);
+ } else error = checkNameEmail(this.user);
if (error) {
alert(this.st.tr[error]);
return;
if (error) {
alert(this.st.tr[error]);
return;
@@
-160,10
+167,15
@@
export default {
this.ajaxMethod(),
this.stage == "Login"
? { nameOrEmail: this.nameOrEmail }
this.ajaxMethod(),
this.stage == "Login"
? { nameOrEmail: this.nameOrEmail }
- : this.
st.
user,
+ : this.user,
() => {
this.infoMsg = this.infoMessage();
if (this.stage != "Update") this.nameOrEmail = "";
() => {
this.infoMsg = this.infoMessage();
if (this.stage != "Update") this.nameOrEmail = "";
+ else {
+ this.st.user.name = this.user.name;
+ this.st.user.email = this.user.email;
+ this.st.user.notify = this.user.notify;
+ }
},
err => {
this.infoMsg = "";
},
err => {
this.infoMsg = "";
diff --git
a/client/src/views/Game.vue
b/client/src/views/Game.vue
index
709cccc
..
1675c30
100644
(file)
--- a/
client/src/views/Game.vue
+++ b/
client/src/views/Game.vue
@@
-248,12
+248,12
@@
export default {
break;
case "killed":
// I logged in elsewhere:
break;
case "killed":
// I logged in elsewhere:
- alert(this.st.tr["New connexion detected: tab now offline"]);
// TODO: this fails. See https://github.com/websockets/ws/issues/489
//this.conn.removeEventListener("message", this.socketMessageListener);
//this.conn.removeEventListener("close", this.socketCloseListener);
//this.conn.close();
this.conn = null;
// TODO: this fails. See https://github.com/websockets/ws/issues/489
//this.conn.removeEventListener("message", this.socketMessageListener);
//this.conn.removeEventListener("close", this.socketCloseListener);
//this.conn.close();
this.conn = null;
+ alert(this.st.tr["New connexion detected: tab now offline"]);
break;
case "askidentity": {
// Request for identification (TODO: anonymous shouldn't need to reply)
break;
case "askidentity": {
// Request for identification (TODO: anonymous shouldn't need to reply)
diff --git
a/client/src/views/Hall.vue
b/client/src/views/Hall.vue
index
7a7f911
..
5ceb7e3
100644
(file)
--- a/
client/src/views/Hall.vue
+++ b/
client/src/views/Hall.vue
@@
-19,7
+19,10
@@
main
.button-group#buttonsTchall
button.acceptBtn(@click="decisionChallenge(true)") {{ st.tr["Accept challenge?"] }}
button.refuseBtn(@click="decisionChallenge(false)") {{ st.tr["Refuse"] }}
.button-group#buttonsTchall
button.acceptBtn(@click="decisionChallenge(true)") {{ st.tr["Accept challenge?"] }}
button.refuseBtn(@click="decisionChallenge(false)") {{ st.tr["Refuse"] }}
- input#modalNewgame.modal(type="checkbox")
+ input#modalNewgame.modal(
+ type="checkbox"
+ @change="cadenceFocusIfOpened($event)"
+ )
div#newgameDiv(
role="dialog"
data-checkbox="modalNewgame"
div#newgameDiv(
role="dialog"
data-checkbox="modalNewgame"
@@
-316,6
+319,10
@@
export default {
},
methods: {
// Helpers:
},
methods: {
// Helpers:
+ cadenceFocusIfOpened: function() {
+ if (event.target.checked)
+ document.getElementById("cadence").focus();
+ },
send: function(code, obj) {
if (this.conn) {
this.conn.send(JSON.stringify(Object.assign({ code: code }, obj)));
send: function(code, obj) {
if (this.conn) {
this.conn.send(JSON.stringify(Object.assign({ code: code }, obj)));
@@
-479,12
+486,12
@@
export default {
}
case "killed":
// I logged in elsewhere:
}
case "killed":
// I logged in elsewhere:
- alert(this.st.tr["New connexion detected: tab now offline"]);
// TODO: this fails. See https://github.com/websockets/ws/issues/489
//this.conn.removeEventListener("message", this.socketMessageListener);
//this.conn.removeEventListener("close", this.socketCloseListener);
//this.conn.close();
this.conn = null;
// TODO: this fails. See https://github.com/websockets/ws/issues/489
//this.conn.removeEventListener("message", this.socketMessageListener);
//this.conn.removeEventListener("close", this.socketCloseListener);
//this.conn.close();
this.conn = null;
+ alert(this.st.tr["New connexion detected: tab now offline"]);
break;
case "askidentity": {
// Request for identification (TODO: anonymous shouldn't need to reply)
break;
case "askidentity": {
// Request for identification (TODO: anonymous shouldn't need to reply)
diff --git
a/client/src/views/Problems.vue
b/client/src/views/Problems.vue
index
2d6ac69
..
7621fe3
100644
(file)
--- a/
client/src/views/Problems.vue
+++ b/
client/src/views/Problems.vue
@@
-2,7
+2,7
@@
main
input#modalNewprob.modal(
type="checkbox"
main
input#modalNewprob.modal(
type="checkbox"
- @change="
infoMsg=''
"
+ @change="
fenFocusIfOpened($event)
"
)
div#newprobDiv(
role="dialog"
)
div#newprobDiv(
role="dialog"
@@
-193,6
+193,12
@@
export default {
}
},
methods: {
}
},
methods: {
+ fenFocusIfOpened: function(event) {
+ if (event.target.checked) {
+ this.infoMsg = "";
+ document.getElementById("inputFen").focus();
+ }
+ },
setVname: function(prob) {
prob.vname = this.st.variants.find(v => v.id == prob.vid).name;
},
setVname: function(prob) {
prob.vname = this.st.variants.find(v => v.id == prob.vid).name;
},
diff --git
a/client/src/views/Variants.vue
b/client/src/views/Variants.vue
index
3fccae5
..
2a3f6cf
100644
(file)
--- a/
client/src/views/Variants.vue
+++ b/
client/src/views/Variants.vue
@@
-9,7
+9,7
@@
main
)
.variant.col-sm-12.col-md-5.col-lg-4(
v-for="(v,idx) in filteredVariants"
)
.variant.col-sm-12.col-md-5.col-lg-4(
v-for="(v,idx) in filteredVariants"
- :class="
{'col-md-offset-1': idx%2==0, 'col-lg-offset-2': idx%2==0}
"
+ :class="
getVclasses(filteredVariants, idx)
"
)
router-link(:to="getLink(v.name)")
h4.boxtitle.text-center {{ v.name }}
)
router-link(:to="getLink(v.name)")
h4.boxtitle.text-center {{ v.name }}
@@
-54,7
+54,15
@@
export default {
},
getLink: function(vname) {
return "/variants/" + vname;
},
getLink: function(vname) {
return "/variants/" + vname;
- }
+ },
+ getVclasses: function(varray, idx) {
+ const idxMod2 = idx % 2;
+ return {
+ 'col-md-offset-1': idxMod2 == 0,
+ 'col-lg-offset-2': idxMod2 == 0,
+ 'last-noneighb': idxMod2 == 0 && idx == varray.length - 1
+ };
+ },
}
};
</script>
}
};
</script>
@@
-79,4
+87,7
@@
input#prefixFilter
.description
@media screen and (max-width: 767px)
margin-top: 0
.description
@media screen and (max-width: 767px)
margin-top: 0
+
+.last-noneighb
+ margin: 0 auto
</style>
</style>
diff --git
a/server/utils/access.js
b/server/utils/access.js
index
049e9eb
..
df86b75
100644
(file)
--- a/
server/utils/access.js
+++ b/
server/utils/access.js
@@
-6,7
+6,7
@@
module.exports =
logged: function(req, res, next) {
const callback = () => {
if (!loggedIn)
logged: function(req, res, next) {
const callback = () => {
if (!loggedIn)
- res.json({errmsg: "
Not logged in
"});
+ res.json({errmsg: "
Error: please delete cookies and cross fingers
"});
else next();
};
let loggedIn = undefined;
else next();
};
let loggedIn = undefined;
@@
-40,7
+40,7
@@
module.exports =
// Just a quick heuristic, which should be enough
const loggedIn = !!req.cookies.token;
if (loggedIn)
// Just a quick heuristic, which should be enough
const loggedIn = !!req.cookies.token;
if (loggedIn)
- res.json({errmsg: "
Already logged in
"});
+ res.json({errmsg: "
Error: please delete cookies and cross fingers
"});
else next();
},
else next();
},