mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-24 05:51:05 +00:00
Compare commits
1 Commits
ee29f0ced1
...
c4eb4a481b
Author | SHA1 | Date | |
---|---|---|---|
c4eb4a481b |
@ -8,7 +8,7 @@ BEGIN TRANSACTION;
|
|||||||
CREATE TABLE Auth (
|
CREATE TABLE Auth (
|
||||||
AccountID INTEGER NOT NULL,
|
AccountID INTEGER NOT NULL,
|
||||||
Cookie TEXT NOT NULL,
|
Cookie TEXT NOT NULL,
|
||||||
Expires INTEGER DEFAULT 0 NOT NULL,
|
Valid INTEGER NOT NULL,
|
||||||
FOREIGN KEY(AccountID) REFERENCES Accounts(AccountID) ON DELETE CASCADE,
|
FOREIGN KEY(AccountID) REFERENCES Accounts(AccountID) ON DELETE CASCADE,
|
||||||
UNIQUE (AccountID)
|
UNIQUE (AccountID)
|
||||||
);
|
);
|
||||||
|
@ -163,7 +163,7 @@ CREATE TABLE IF NOT EXISTS RedeemedCodes (
|
|||||||
CREATE TABLE IF NOT EXISTS Auth (
|
CREATE TABLE IF NOT EXISTS Auth (
|
||||||
AccountID INTEGER NOT NULL,
|
AccountID INTEGER NOT NULL,
|
||||||
Cookie TEXT NOT NULL,
|
Cookie TEXT NOT NULL,
|
||||||
Expires INTEGER DEFAULT 0 NOT NULL,
|
Valid INTEGER DEFAULT 0 NOT NULL,
|
||||||
FOREIGN KEY(AccountID) REFERENCES Accounts(AccountID) ON DELETE CASCADE,
|
FOREIGN KEY(AccountID) REFERENCES Accounts(AccountID) ON DELETE CASCADE,
|
||||||
UNIQUE (AccountID)
|
UNIQUE (AccountID)
|
||||||
);
|
);
|
||||||
|
@ -104,12 +104,12 @@ bool Database::checkCookie(int accountId, const char *tryCookie) {
|
|||||||
const char* sql_get = R"(
|
const char* sql_get = R"(
|
||||||
SELECT Cookie
|
SELECT Cookie
|
||||||
FROM Auth
|
FROM Auth
|
||||||
WHERE AccountID = ? AND Expires > ?;
|
WHERE AccountID = ? AND Valid = 1;
|
||||||
)";
|
)";
|
||||||
|
|
||||||
const char* sql_invalidate = R"(
|
const char* sql_invalidate = R"(
|
||||||
UPDATE Auth
|
UPDATE Auth
|
||||||
SET Expires = 0
|
SET Valid = 0
|
||||||
WHERE AccountID = ?;
|
WHERE AccountID = ?;
|
||||||
)";
|
)";
|
||||||
|
|
||||||
@ -117,7 +117,6 @@ bool Database::checkCookie(int accountId, const char *tryCookie) {
|
|||||||
|
|
||||||
sqlite3_prepare_v2(db, sql_get, -1, &stmt, NULL);
|
sqlite3_prepare_v2(db, sql_get, -1, &stmt, NULL);
|
||||||
sqlite3_bind_int(stmt, 1, accountId);
|
sqlite3_bind_int(stmt, 1, accountId);
|
||||||
sqlite3_bind_int(stmt, 2, getTimestamp());
|
|
||||||
int rc = sqlite3_step(stmt);
|
int rc = sqlite3_step(stmt);
|
||||||
if (rc != SQLITE_ROW) {
|
if (rc != SQLITE_ROW) {
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
|
Loading…
Reference in New Issue
Block a user