diff --git a/Cargo.lock b/Cargo.lock index 96a24b7..bef619c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -158,7 +158,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "based" version = "0.1.0" -source = "git+https://git.hydrar.de/jmarya/based#cd10c64a1f96703894de9e40a95fd81cc50d244a" +source = "git+https://git.hydrar.de/jmarya/based#4e3107ce08aaf6f149880a00707f86f1e94683eb" dependencies = [ "bcrypt", "chrono", @@ -1705,9 +1705,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -2039,9 +2039,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" @@ -2520,9 +2520,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.91" +version = "2.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035" +checksum = "70ae51629bf965c5c098cc9e87908a3df5301051a9e087d6f9bef5c9771ed126" dependencies = [ "proc-macro2", "quote", @@ -2873,9 +2873,9 @@ dependencies = [ [[package]] name = "unicase" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicase_serde" diff --git a/migrations/0006_based_update.sql b/migrations/0006_based_update.sql new file mode 100644 index 0000000..bed4396 --- /dev/null +++ b/migrations/0006_based_update.sql @@ -0,0 +1,13 @@ +CREATE TYPE session_kind AS ENUM ('api', 'user'); + +ALTER TABLE user_session + ADD COLUMN IF NOT EXISTS "created" timestamptz NOT NULL DEFAULT NOW(), + ADD COLUMN IF NOT EXISTS "csrf" UUID NOT NULL DEFAULT gen_random_uuid(), + ADD COLUMN IF NOT EXISTS "name" VARCHAR(255), + ADD COLUMN IF NOT EXISTS kind session_kind NOT NULL DEFAULT 'user'; + +CREATE TABLE IF NOT EXISTS user_profile_pic ( + username VARCHAR(255) NOT NULL PRIMARY KEY, + "image" bytea NOT NULL, + FOREIGN KEY (username) REFERENCES users(username) +); diff --git a/src/pages/user.rs b/src/pages/user.rs index 60b9b35..64bcecf 100644 --- a/src/pages/user.rs +++ b/src/pages/user.rs @@ -1,4 +1,4 @@ -use based::auth::User; +use based::auth::{Sessions, User}; use based::request::StringResponse; use based::{auth::MaybeUser, request::RequestContext}; use maud::html;