Creat signout logic, make links use it.

This commit is contained in:
Eli Ribble 2026-01-15 00:20:19 +00:00
parent 35721e7fa6
commit 92294e5b16
No known key found for this signature in database
5 changed files with 15 additions and 2 deletions

View file

@ -125,6 +125,12 @@ func SigninUser(r *http.Request, username string, password string) (*models.User
return user, nil
}
func SignoutUser(r *http.Request, user *models.User) {
sessionManager.Put(r.Context(), "user_id", "")
sessionManager.Put(r.Context(), "username", "")
log.Info().Str("username", user.Username).Int32("user_id", user.ID).Msg("Ended user session")
}
func SignupUser(ctx context.Context, username string, name string, password string) (*models.User, error) {
passwordHash, err := hashPassword(password)
if err != nil {