Changed token in user params to jwt since token was way too vague

This commit is contained in:
shockrah 2020-12-28 23:05:31 -08:00
parent b351f63db5
commit b7209c000c

View File

@ -99,7 +99,7 @@ pub fn encrypt_secret(raw: &str) -> BcryptResult<String> {
fn jwt_from_serde(params: &serde_json::Value) -> Option<&str> {
// gets the `token` from the parameters
// option<value> -> 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<hyper::Body>
&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"));