chg: Get rid of naked unwraps and improve code flow

This commit is contained in:
SinTan1729
2024-04-02 17:43:36 -05:00
parent f27984a63f
commit 0469f9b933
4 changed files with 53 additions and 29 deletions

View File

@@ -7,8 +7,11 @@ pub fn validate(session: Session) -> bool {
return true;
}
let token = session.get::<String>("session-token");
token.is_ok() && check(token.unwrap())
if let Ok(token) = session.get::<String>("session-token") {
check(token)
} else {
false
}
}
fn check(token: Option<String>) -> bool {