Changed token
in user params to jwt
since token was way too vague
This commit is contained in:
parent
b351f63db5
commit
b7209c000c
@ -99,7 +99,7 @@ pub fn encrypt_secret(raw: &str) -> BcryptResult<String> {
|
|||||||
fn jwt_from_serde(params: &serde_json::Value) -> Option<&str> {
|
fn jwt_from_serde(params: &serde_json::Value) -> Option<&str> {
|
||||||
// gets the `token` from the parameters
|
// gets the `token` from the parameters
|
||||||
// option<value> -> some(value) -> string
|
// 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 {
|
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"))
|
&EncodingKey::from_base64_secret(HMAC_SECRET.as_ref()).expect("Couldn't encode from secret"))
|
||||||
.expect("Could not encode JWT");
|
.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(_) => {
|
Ok(_) => {
|
||||||
response.headers_mut().insert("Content-Type",
|
response.headers_mut().insert("Content-Type",
|
||||||
HeaderValue::from_static("application/json"));
|
HeaderValue::from_static("application/json"));
|
||||||
|
Loading…
Reference in New Issue
Block a user