add last_used to user_tokens table

This commit is contained in:
deneb 2024-02-10 13:18:08 +01:00
parent 26bdc4c742
commit be6e2cb6cd
2 changed files with 6 additions and 7 deletions

View file

@ -21,8 +21,6 @@ impl Authenticator {
#[instrument]
pub async fn create_user_token(&mut self, username: &str, password: &Password) -> UserToken {
// let created =
let mut token_str = "".to_owned();
let mut rng = thread_rng();

View file

@ -36,11 +36,12 @@ impl SqliteDatabase {
query(
"CREATE TABLE IF NOT EXISTS {TABLE_USER_TOKENS} (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username VARCHAR(255),
token NCHAR(30),
created DATETIME,
valid BOOLEAN,
);",
username VARCHAR(255) NOT NULL,
token NCHAR(30) NOT NULL,
valid BOOLEAN NOT NULL,
created DATETIME NOT NULL,
last_used DATETIME
)",
)
.execute(&mut self.conn)
.await