Removed redudancies and loud error messages
This commit is contained in:
parent
f5f3df2ee2
commit
8661bcabe7
@ -20,7 +20,6 @@ pub enum AuthReason {
|
|||||||
|
|
||||||
fn valid_secret(given_pass: &str, hash: &str) -> bool {
|
fn valid_secret(given_pass: &str, hash: &str) -> bool {
|
||||||
let result = bcrypt::verify(given_pass, hash);
|
let result = bcrypt::verify(given_pass, hash);
|
||||||
println!("\tGiven: {} \tRaw: {}\t{:?}", given_pass, hash, result);
|
|
||||||
return match result {
|
return match result {
|
||||||
Ok(result) => result,
|
Ok(result) => result,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@ -76,7 +75,7 @@ pub async fn wall_entry(path: &str, pool: &Pool, params: &serde_json::Value) ->
|
|||||||
let secret = secret_v.as_str().unwrap_or("");
|
let secret = secret_v.as_str().unwrap_or("");
|
||||||
return match Member::get(pool, id).await {
|
return match Member::get(pool, id).await {
|
||||||
Response::Row(user) => {
|
Response::Row(user) => {
|
||||||
if valid_secret(secret, &user.secret) == true && valid_perms(user, path){
|
if valid_secret(secret, &user.secret) && valid_perms(user, path){
|
||||||
Ok(AuthReason::Good)
|
Ok(AuthReason::Good)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user