mirror of https://github.com/calzoneman/sync.git
Fixes for bot logins
This commit is contained in:
parent
05b40b8091
commit
33f775051d
|
@ -134,7 +134,7 @@ module.exports = {
|
||||||
callback(err, null);
|
callback(err, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accts.length >= Config.get("max-accounts-per-ip")) {
|
if (accts.length >= Config.get("max-accounts-per-ip")) {
|
||||||
delete registrationLock[lname];
|
delete registrationLock[lname];
|
||||||
callback("You have registered too many accounts from this "+
|
callback("You have registered too many accounts from this "+
|
||||||
|
@ -207,7 +207,7 @@ module.exports = {
|
||||||
the hashes match.
|
the hashes match.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
db.query("SELECT name,password,global_rank FROM `users` WHERE name=?",
|
db.query("SELECT name,password,global_rank,time FROM `users` WHERE name=?",
|
||||||
[name],
|
[name],
|
||||||
function (err, rows) {
|
function (err, rows) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -288,6 +288,7 @@ User.prototype.login = function (name, pw) {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.account.name = user.name;
|
self.account.name = user.name;
|
||||||
|
self.registrationTime = new Date(user.time);
|
||||||
self.setFlag(Flags.U_REGISTERED);
|
self.setFlag(Flags.U_REGISTERED);
|
||||||
self.refreshAccount(function (err, account) {
|
self.refreshAccount(function (err, account) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -451,11 +452,11 @@ User.prototype.refreshAccount = function (cb) {
|
||||||
|
|
||||||
User.prototype.getFirstSeenTime = function getFirstSeenTime() {
|
User.prototype.getFirstSeenTime = function getFirstSeenTime() {
|
||||||
if (this.registrationTime && this.socket.ipSessionFirstSeen) {
|
if (this.registrationTime && this.socket.ipSessionFirstSeen) {
|
||||||
return Math.min(this.registrationTime.getTime(), this.socket.ipSessionFirstSeen);
|
return Math.min(this.registrationTime.getTime(), this.socket.ipSessionFirstSeen.getTime());
|
||||||
} else if (this.registrationTime) {
|
} else if (this.registrationTime) {
|
||||||
return this.registrationTime.getTime();
|
return this.registrationTime.getTime();
|
||||||
} else if (this.socket.ipSessionFirstSeen) {
|
} else if (this.socket.ipSessionFirstSeen) {
|
||||||
return this.socket.ipSessionFirstSeen;
|
return this.socket.ipSessionFirstSeen.getTime();
|
||||||
} else {
|
} else {
|
||||||
Logger.errlog.log(`User "${this.getName()}" (IP: ${this.realip}) has neither ` +
|
Logger.errlog.log(`User "${this.getName()}" (IP: ${this.realip}) has neither ` +
|
||||||
"an IP sesion first seen time nor a registered account.");
|
"an IP sesion first seen time nor a registered account.");
|
||||||
|
|
Loading…
Reference in New Issue