Sfoglia il codice sorgente

reuse session for loggined user.

master
sp 4 anni fa
parent
commit
48daedc16a
2 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. +3
    -1
      apiV1login.go
  2. +1
    -0
      main.go

+ 3
- 1
apiV1login.go Vedi File

} }
//log in user //log in user
if u.Id == ss.User { if u.Id == ss.User {
ss.RenewIfExpireSoon()
*ss = trial //we are the same
} else if !ss.IsEmpty() {
ss.ReuseAsUser(u.Id, ss.Expire)
} else { } else {
ss.InitForUser(ss.User, time.Now().Add(loan.DefaultSessionDuration)) ss.InitForUser(ss.User, time.Now().Add(loan.DefaultSessionDuration))
} }

+ 1
- 0
main.go Vedi File

ar := apiV1ResponseBlank() ar := apiV1ResponseBlank()
ar.Env.Msg = msg ar.Env.Msg = msg
ar.Env.Session = *ss ar.Env.Session = *ss
ar.Env.Session.Bin = []byte("masked data") //clear
ar.Env.Session.Secret = "***********" ar.Env.Session.Secret = "***********"
ar.add("Body", dumpLines) ar.add("Body", dumpLines)
b, _ := ar.toJson() b, _ := ar.toJson()

Loading…
Annulla
Salva