mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Use a proper id for sessions, leave token as a separate field
This commit is contained in:
parent
b340958348
commit
7b08afde06
@ -78,8 +78,8 @@ func (h *Handler) createSession(c echo.Context, user *User) error {
|
||||
}
|
||||
|
||||
session, err := h.db.CreateSession(ctx, dbc.CreateSessionParams{
|
||||
ID: base64.StdEncoding.EncodeToString(id),
|
||||
UserID: user.ID,
|
||||
Token: base64.StdEncoding.EncodeToString(id),
|
||||
UserID: user.Id,
|
||||
Device: device,
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -1,7 +1,8 @@
|
||||
begin;
|
||||
|
||||
create table sessions(
|
||||
id varchar(128) not null primary key,
|
||||
id uuid not null primary key,
|
||||
token varchar(128) not null unique,
|
||||
user_id uuid not null references users(id) on delete cascade,
|
||||
created_date timestamptz not null default now()::timestamptz,
|
||||
last_used timestamptz not null default now()::timestamptz,
|
||||
|
Loading…
x
Reference in New Issue
Block a user