summaryrefslogtreecommitdiff
path: root/server/src/models/auth.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-10-18 21:14:16 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-10-18 21:14:16 +0200
commit434423454db3a7244c0f1e422f1ab2df06f7d867 (patch)
treeb1f98748e6aef4ff8f0c35845fcdb874297ebd27 /server/src/models/auth.rs
parent9a06462a04c268e7493bd490608f3dd4b2d01c00 (diff)
Add signup
Diffstat (limited to 'server/src/models/auth.rs')
-rw-r--r--server/src/models/auth.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/src/models/auth.rs b/server/src/models/auth.rs
index 8b8f61c..1e466d3 100644
--- a/server/src/models/auth.rs
+++ b/server/src/models/auth.rs
@@ -18,7 +18,7 @@ struct Keys {
#[derive(Serialize, Deserialize)]
pub struct Claims {
/// ID from the user model
- user_id: i32,
+ pub user_id: i32,
/// Expiration timestamp
exp: usize,
}
@@ -32,6 +32,14 @@ pub struct AuthBody {
token_type: String,
}
+/// Paylod used for user creation
+#[derive(Deserialize)]
+pub struct SignUpForm {
+ pub email: String,
+ pub password1: String,
+ pub password2: String,
+}
+
static KEYS: Lazy<Keys> = Lazy::new(|| {
let secret = std::env::var("JWT_SECRET").expect("JWT_SECRET must be set");
Keys::new(secret.as_bytes())