add last_used to user_tokens table
This commit is contained in:
parent
26bdc4c742
commit
be6e2cb6cd
2 changed files with 6 additions and 7 deletions
|
@ -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();
|
||||
|
|
11
src/db.rs
11
src/db.rs
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue