feat: adding redis to save sessions
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"sunshine.industries/some-automoderation/sessions"
|
||||
)
|
||||
|
||||
func registerLoginRoutes(templateFs *embed.FS, sessions *sessions.DummySM) {
|
||||
func registerLoginRoutes(templateFs *embed.FS, sessionSM sessions.SessionManagement) {
|
||||
// login page
|
||||
http.HandleFunc("/login", func(w http.ResponseWriter, r *http.Request) {
|
||||
var templFile = "templates/login.gohtml"
|
||||
@@ -36,9 +36,12 @@ func registerLoginRoutes(templateFs *embed.FS, sessions *sessions.DummySM) {
|
||||
roomId := 1 // would be taken from rooms interface from redis
|
||||
// would be either taken from room info on correct person pass or created
|
||||
personId := 111
|
||||
sessions.Save(int64(roomId), int64(personId))
|
||||
id, err := sessionSM.Save(int64(roomId), int64(personId))
|
||||
if err != nil {
|
||||
log.Printf("/login/submit > error saving session %s", err)
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "room things %s & %s, personal things %s and %s", rn, rp, pn, pp)
|
||||
fmt.Fprintf(w, "is is %d. room things %s & %s, personal things %s and %s", id, rn, rp, pn, pp)
|
||||
// i suppose here i'll need to
|
||||
// a) check if room password OK
|
||||
// b) get room data
|
||||
|
||||
@@ -15,7 +15,7 @@ var templateFs embed.FS
|
||||
//go:embed static
|
||||
var staticFilesFs embed.FS
|
||||
|
||||
func RegisterRoutes(sessions *sessions.DummySM) {
|
||||
func RegisterRoutes(sessions sessions.SessionManagement) {
|
||||
// login page
|
||||
registerLoginRoutes(&templateFs, sessions)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user