mirror of
https://github.com/exane/not-gwent-online
synced 2024-12-23 21:03:14 +00:00
limit user name to 20 chars
This commit is contained in:
parent
b9daf667c3
commit
41ac09c59c
@ -705,7 +705,7 @@ let ChooseSideModal = Modal.extend({
|
||||
|
||||
let User = Backbone.Model.extend({
|
||||
defaults: {
|
||||
name: localStorage["userName"] || null,
|
||||
name: typeof localStorage["userName"] === "string" ? localStorage["userName"].slice(0, 20) : null,
|
||||
deck: localStorage["userDeck"] || "random",
|
||||
serverOffline: true
|
||||
},
|
||||
@ -834,6 +834,7 @@ let User = Backbone.Model.extend({
|
||||
//app.socket.subscribe(room);
|
||||
},
|
||||
setName: function(name){
|
||||
name = name.slice(0, 20);
|
||||
this.get("app").send("request:name", {name: name});
|
||||
localStorage["userName"] = name;
|
||||
},
|
||||
@ -916,6 +917,7 @@ let Lobby = Backbone.View.extend({
|
||||
/*let val = $(e.target).val();
|
||||
this.app.trigger("setDeck", val);
|
||||
this.$el.find("#deckChoice option[value='" + val + "']").attr("selected", "selected")*/
|
||||
|
||||
localStorage["userName"] = this.app.user.get("name");
|
||||
/*this.render();*/
|
||||
this.$el.find(".name-input").val(this.app.user.get("name"));
|
||||
|
@ -51,6 +51,7 @@ var User = (function(){
|
||||
}
|
||||
|
||||
r.setName = function(name) {
|
||||
name = name.slice(0, 20);
|
||||
console.log("user name changed from %s to %s", this._name, name);
|
||||
this._name = name;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user