OnHostChanged event and add tokens to session.

This commit is contained in:
Miroslav Šedivý 2021-03-13 22:17:49 +01:00
parent 453a6905f7
commit 3fcca6ab52
6 changed files with 43 additions and 12 deletions

View file

@ -31,7 +31,7 @@ func (api *ApiManagerCtx) Login(w http.ResponseWriter, r *http.Request) {
}
// TODO: Proper login.
session, err := api.sessions.Create(types.MemberProfile{
session, token, err := api.sessions.Create(types.MemberProfile{
Name: data.ID,
IsAdmin: true,
CanLogin: true,
@ -53,7 +53,7 @@ func (api *ApiManagerCtx) Login(w http.ResponseWriter, r *http.Request) {
http.SetCookie(w, &http.Cookie{
Name: "NEKO_SESSION",
Value: session.ID(),
Value: token,
Expires: CookieExpirationDate,
Secure: !UnsecureCookies,
SameSite: sameSite,