fix: don't allow fallback for users in local db

This commit is contained in:
əlemi 2023-11-20 02:24:50 +01:00
parent 0f310896d7
commit be3362f7dd
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -42,13 +42,14 @@ pub async fn has_joined_wrapper(State(state): State<AppState>, Query(query): Que
match has_joined_local(&state, username, server_id, user_ip).await { match has_joined_local(&state, username, server_id, user_ip).await {
Ok(r) => Ok(r), Ok(r) => Ok(r),
Err(e) => { Err(StatusCode::MOVED_PERMANENTLY) => {
if state.fallback { if state.fallback {
Ok(has_joined_microsoft(&state, username, server_id, user_ip).await?) Ok(has_joined_microsoft(&state, username, server_id, user_ip).await?)
} else { } else {
Err(e) Err(StatusCode::UNAUTHORIZED)
} }
} },
Err(e) => Err(e),
} }
} }
@ -98,7 +99,7 @@ pub async fn has_joined_local(state: &AppState, username: &String, server_id: &S
}, },
None => { None => {
warn!(target: "SESSION", "[HAS_JOINED] server didn't find user"); warn!(target: "SESSION", "[HAS_JOINED] server didn't find user");
Err(StatusCode::NOT_FOUND) Err(StatusCode::MOVED_PERMANENTLY)
}, },
} }
}, },