You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-31 09:24:31 +03:00
strorage: browser session and user password repositories
This commit is contained in:
@ -57,10 +57,16 @@ pub struct BrowserSession {
|
||||
pub id: Ulid,
|
||||
pub user: User,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub finished_at: Option<DateTime<Utc>>,
|
||||
pub last_authentication: Option<Authentication>,
|
||||
}
|
||||
|
||||
impl BrowserSession {
|
||||
#[must_use]
|
||||
pub fn active(&self) -> bool {
|
||||
self.finished_at.is_none()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn was_authenticated_after(&self, after: DateTime<Utc>) -> bool {
|
||||
if let Some(auth) = &self.last_authentication {
|
||||
@ -80,6 +86,7 @@ impl BrowserSession {
|
||||
id: Ulid::from_datetime_with_source(now.into(), rng),
|
||||
user,
|
||||
created_at: now,
|
||||
finished_at: None,
|
||||
last_authentication: None,
|
||||
})
|
||||
.collect()
|
||||
|
Reference in New Issue
Block a user