Skip to content

Commit

Permalink
FIXES #591
Browse files Browse the repository at this point in the history
This should fix the login in the event that the cookie doesn't exist at all.
  • Loading branch information
thebracket committed Dec 5, 2024
1 parent c0da049 commit 4351de8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/rust/lqosd/src/node_manager/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ pub enum LoginResult {
async fn check_login(jar: &CookieJar, users: &WebUsers) -> LoginResult {
if let Some(token) = jar.get(COOKIE_PATH) {
// Validate the token
return match users.get_role_from_token(token.value()).unwrap() {
UserRole::ReadOnly => LoginResult::ReadOnly,
UserRole::Admin => LoginResult::Admin,
return match users.get_role_from_token(token.value()) {
Ok(UserRole::ReadOnly) => LoginResult::ReadOnly,
Ok(UserRole::Admin) => LoginResult::Admin,
Err(_e) => LoginResult::Denied,
}
}
LoginResult::Denied
Expand Down

0 comments on commit 4351de8

Please sign in to comment.