ezidam: added logout page, added RefreshToken guard

This commit is contained in:
Philippe Loctaux 2023-03-18 21:49:08 +01:00
parent 49b3a3d1fe
commit 5100aa1b4e
10 changed files with 205 additions and 3 deletions

View file

@ -41,4 +41,17 @@ impl RefreshToken {
)
.await?)
}
pub async fn get_one(
conn: impl SqliteExecutor<'_>,
token: &str,
) -> Result<Option<Self>, Error> {
Ok(DatabaseRefreshTokens::get_one(conn, token)
.await?
.map(Self::from))
}
pub async fn revoke(self, conn: impl SqliteExecutor<'_>) -> Result<Option<()>, Error> {
Ok(DatabaseRefreshTokens::revoke(conn, &self.token).await?)
}
}