mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -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{
|
session, err := h.db.CreateSession(ctx, dbc.CreateSessionParams{
|
||||||
ID: base64.StdEncoding.EncodeToString(id),
|
Token: base64.StdEncoding.EncodeToString(id),
|
||||||
UserID: user.ID,
|
UserID: user.Id,
|
||||||
Device: device,
|
Device: device,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
begin;
|
begin;
|
||||||
|
|
||||||
create table sessions(
|
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,
|
user_id uuid not null references users(id) on delete cascade,
|
||||||
created_date timestamptz not null default now()::timestamptz,
|
created_date timestamptz not null default now()::timestamptz,
|
||||||
last_used timestamptz not null default now()::timestamptz,
|
last_used timestamptz not null default now()::timestamptz,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user