mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-13 07:07:45 +00:00
When no session is found when logging into the lobby, show an error msg
It's the wrong error message, but it's better than getting an empty lobby screen!
This commit is contained in:
parent
7c96edc9a4
commit
e43ab6c42a
2 changed files with 13 additions and 4 deletions
|
@ -90,9 +90,14 @@ async fn main() {
|
|||
let service_accounts: Option<Vec<ServiceAccount>> =
|
||||
serde_json::from_str(&body).ok();
|
||||
if let Some(service_accounts) = service_accounts {
|
||||
connection.service_accounts = service_accounts;
|
||||
connection.session_id = Some(session_id.clone());
|
||||
connection.send_account_list().await;
|
||||
if service_accounts.is_empty() {
|
||||
// request an update, wrong error message lol
|
||||
connection.send_error(*sequence, 1012, 13101).await;
|
||||
} else {
|
||||
connection.service_accounts = service_accounts;
|
||||
connection.session_id = Some(session_id.clone());
|
||||
connection.send_account_list().await;
|
||||
}
|
||||
} else {
|
||||
// request an update, wrong error message lol
|
||||
connection.send_error(*sequence, 1012, 13101).await;
|
||||
|
|
|
@ -147,7 +147,11 @@ impl LoginDatabase {
|
|||
.prepare("SELECT user_id FROM sessions WHERE sid = ?1")
|
||||
.ok()
|
||||
.unwrap();
|
||||
user_id = stmt.query_row((sid,), |row| row.get(0)).unwrap();
|
||||
if let Ok(found_user_id) = stmt.query_row((sid,), |row| row.get(0)) {
|
||||
user_id = found_user_id;
|
||||
} else {
|
||||
return Vec::default();
|
||||
}
|
||||
}
|
||||
|
||||
// service accounts
|
||||
|
|
Loading…
Add table
Reference in a new issue