summaryrefslogtreecommitdiff
path: root/db/db.go
diff options
context:
space:
mode:
Diffstat (limited to 'db/db.go')
-rw-r--r--db/db.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/db/db.go b/db/db.go
index 50b1f17..059f1df 100644
--- a/db/db.go
+++ b/db/db.go
@@ -130,8 +130,8 @@ func (d *DB) CreateAccount(ctx context.Context, username, plaintextPW string) (*
}
res, err := d.conn.ExecContext(ctx,
- `INSERT INTO account (username, password, refresh_token, access_token, access_token_created)
- VALUES (?, ?, ?, ?, NOW())`,
+ `INSERT INTO account (username, password, refresh_token, access_token, refresh_token_created, access_token_created)
+ VALUES (?, ?, ?, ?, NOW(), NOW())`,
username, plaintextPW,
tokens.RefreshToken,
tokens.AccessToken,
@@ -199,7 +199,7 @@ func (d *DB) RotateTokens(ctx context.Context, id int64) (*Account, error) {
}
res, err := d.conn.ExecContext(ctx,
- `UPDATE account SET refresh_token = ?, access_token = ?, access_token_created = NOW()
+ `UPDATE account SET refresh_token = ?, access_token = ?, refresh_token_created = NOW(), access_token_created = NOW()
WHERE id = ?`, rt, at, id)
if err != nil {
return nil, fmt.Errorf("rotate tokens: %w", err)