mirror of
https://github.com/maierfelix/POGOserver.git
synced 2026-09-10 03:26:19 -05:00
Database bug fix
- Multiple account bug fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "POGOServer",
|
||||
"version": "0.2.9",
|
||||
"version": "0.3.0",
|
||||
"description": "",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -73,7 +73,8 @@ export function getUserByEmail(email) {
|
||||
return new Promise((resolve) => {
|
||||
let collection = this.getUserCollection();
|
||||
collection.find({email: email}).toArray((err, docs) => {
|
||||
resolve(docs);
|
||||
if (docs && docs.length) resolve(docs[0]);
|
||||
else resolve(void 0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,11 +101,9 @@ export function createTable(name) {
|
||||
export function getUserByEmail(email) {
|
||||
return new Promise((resolve) => {
|
||||
this.db.instance.query(`SELECT * FROM ${CFG.SERVER_MYSQL_TABLE} WHERE email=? LIMIT 1`, [email], (e, rows, fields) => {
|
||||
if (e) {
|
||||
console.log(e);
|
||||
} else {
|
||||
resolve(rows[0]);
|
||||
}
|
||||
if (e) console.log(e);
|
||||
if (rows && rows.length) resolve(rows[0]);
|
||||
else resolve(void 0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -304,13 +304,13 @@ export function forwardPlayer() {
|
||||
if (player.email.length) {
|
||||
this.print(`${player.email.replace("@gmail.com", "")} authenticated!`, 36);
|
||||
}
|
||||
if (doc === void 0 || doc && !doc.length) {
|
||||
this.registerPlayer().then((res) => {
|
||||
if (doc) {
|
||||
this.loginPlayer().then((res) => {
|
||||
resolve(res);
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.loginPlayer().then((res) => {
|
||||
this.registerPlayer().then((res) => {
|
||||
resolve(res);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,4 +33,4 @@ export function setup() {
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user