From b7209c000cf662ba3262fb217823ac37f546f0e2 Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 28 Dec 2020 23:05:31 -0800 Subject: [PATCH] Changed `token` in user params to `jwt` since token was way too vague --- server-api/src/auth.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server-api/src/auth.rs b/server-api/src/auth.rs index 747a0bd..96ebf95 100644 --- a/server-api/src/auth.rs +++ b/server-api/src/auth.rs @@ -99,7 +99,7 @@ pub fn encrypt_secret(raw: &str) -> BcryptResult { fn jwt_from_serde(params: &serde_json::Value) -> Option<&str> { // gets the `token` from the parameters // option -> some(value) -> string - return params.get("token")?.as_str(); + return params.get("jwt")?.as_str(); } async fn valid_jwt(p: &Pool, token: &str) -> AuthReason { @@ -201,7 +201,7 @@ pub async fn login_get_jwt(p: &Pool, response: &mut hyper::Response &EncodingKey::from_base64_secret(HMAC_SECRET.as_ref()).expect("Couldn't encode from secret")) .expect("Could not encode JWT"); - match db::auth::add_jwt(p, encoded.as_ref()).await { + match db::auth::add_jwt(p, id, encoded.as_ref()).await { Ok(_) => { response.headers_mut().insert("Content-Type", HeaderValue::from_static("application/json"));