fixed auth module not using str version of the secret key
This commit is contained in:
parent
ed6c19314a
commit
0a0967d196
@ -21,17 +21,30 @@ pub async fn wall_entry(path: &str, pool: &Pool, params: &serde_json::Value) ->
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if let Some(key) = params.get("secret") {
|
if let Some(key) = params.get("secret") {
|
||||||
|
let key_str = key.as_str();
|
||||||
let conn = pool.get_conn().await?;
|
let conn = pool.get_conn().await?;
|
||||||
// (id, name, secret)
|
// (id, name, secret)
|
||||||
let (_con, row): (_, Option<(UBigInt, VarChar)>) = conn
|
type row_type = Option<(UBigInt, VarChar)>;
|
||||||
.first_exec(r"SELECT userid, name FROM keys WHERE secret = :secret ", mysql_async::params!{ "secret" => key})
|
let db_result: Result<(_, row_type), mysql_async::error::Error> = conn
|
||||||
.await?;
|
.first_exec(r"SELECT id, name FROM members WHERE secret = :secret ", mysql_async::params!{ "secret" => key_str})
|
||||||
|
.await;
|
||||||
// yeayea i no
|
|
||||||
match row {
|
match db_result {
|
||||||
Some(_) => Ok(AuthReason::Good),
|
Ok((_, row)) => {
|
||||||
None => Ok(AuthReason::NoKey)
|
match row{
|
||||||
|
Some(_) => Ok(AuthReason::Good),
|
||||||
|
None => Ok(AuthReason::NoKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
println!("Issue fetching auth data {:?}", e);
|
||||||
|
Ok(AuthReason::NoKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//let (_con, row): (_, Option<(UBigInt, VarChar)>) = conn
|
||||||
|
// .first_exec(r"SELECT userid, name FROM keys WHERE secret = :secret ", mysql_async::params!{ "secret" => key})
|
||||||
|
// .await;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Ok(AuthReason::NoKey)
|
Ok(AuthReason::NoKey)
|
||||||
|
Loading…
Reference in New Issue
Block a user