mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 12:46:49 +00:00
fix: SEC16
This commit is contained in:
3 files changed
+6
-2
No files matched your search
@@ -379,6 +379,9 @@ async fn find_token(services: &Services, token: Option<&str>) -> Result<Token> {
|
||||
let Some(token) = token else {
|
||||
return Ok(Token::None);
|
||||
};
|
||||
if token.is_empty() {
|
||||
return Ok(Token::Invalid);
|
||||
}
|
||||
|
||||
let user_token = services.users.find_from_token(token).map_ok(Token::User);
|
||||
|
||||
|
||||
@@ -339,6 +339,7 @@ impl Service {
|
||||
|
||||
/// Find out which user an access token belongs to.
|
||||
pub async fn find_from_token(&self, token: &str) -> Result<(OwnedUserId, OwnedDeviceId)> {
|
||||
assert!(!token.is_empty(), "Empty access token");
|
||||
self.db.token_userdeviceid.get(token).await.deserialized()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user