Fix profile/rank for bot logins
This commit is contained in:
parent
99760b6989
commit
ad4ee4bd02
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "3.23.0",
|
||||
"version": "3.23.1",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
|
@ -334,6 +334,12 @@ Channel.prototype.joinUser = function (user, data) {
|
|||
if (!error) {
|
||||
user.setChannelRank(rank);
|
||||
user.setFlag(Flags.U_HAS_CHANNEL_RANK);
|
||||
if (user.inChannel()) {
|
||||
self.broadcastAll("setUserRank", {
|
||||
name: user.getName(),
|
||||
rank: rank
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,6 +16,17 @@ function wildcardSimilarChars(name) {
|
|||
return name.replace(/_/g, "\\_").replace(/[Il1oO0]/g, "_");
|
||||
}
|
||||
|
||||
function parseProfile(data) {
|
||||
try {
|
||||
var profile = JSON.parse(data.profile);
|
||||
profile.image = profile.image || "";
|
||||
profile.text = profile.text || "";
|
||||
data.profile = profile;
|
||||
} catch (error) {
|
||||
data.profile = { image: "", text: "" };
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
init: function () {
|
||||
},
|
||||
|
@ -83,15 +94,7 @@ module.exports = {
|
|||
return callback("User does not exist");
|
||||
}
|
||||
|
||||
try {
|
||||
var profile = JSON.parse(rows[0].profile);
|
||||
profile.image = profile.image || "";
|
||||
profile.text = profile.text || "";
|
||||
rows[0].profile = profile;
|
||||
} catch (error) {
|
||||
rows[0].profile = { image: "", text: "" };
|
||||
}
|
||||
|
||||
parseProfile(rows[0]);
|
||||
callback(null, rows[0]);
|
||||
});
|
||||
},
|
||||
|
@ -216,7 +219,7 @@ module.exports = {
|
|||
the hashes match.
|
||||
*/
|
||||
|
||||
db.query("SELECT name,password,global_rank,time FROM `users` WHERE name=?",
|
||||
db.query("SELECT * FROM `users` WHERE name=?",
|
||||
[name],
|
||||
function (err, rows) {
|
||||
if (err) {
|
||||
|
@ -235,6 +238,7 @@ module.exports = {
|
|||
} else if (!match) {
|
||||
callback("Invalid username/password combination", null);
|
||||
} else {
|
||||
parseProfile(rows[0]);
|
||||
callback(null, rows[0]);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue