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] #[instrument]
pub async fn create_user_token(&mut self, username: &str, password: &Password) -> UserToken { pub async fn create_user_token(&mut self, username: &str, password: &Password) -> UserToken {
// let created =
let mut token_str = "".to_owned(); let mut token_str = "".to_owned();
let mut rng = thread_rng(); let mut rng = thread_rng();

View file

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