0.3.33
This commit is contained in:
@@ -87,6 +87,13 @@ func (s *Server) handleLogin(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusBadRequest, "device name is too long")
|
||||
return
|
||||
}
|
||||
log := s.loggerFor(r.Context()).With(
|
||||
"emby_client", s.cfg.ClientName,
|
||||
"device", req.DeviceName,
|
||||
"device_id", req.DeviceID,
|
||||
"client_version", clientVersion(r),
|
||||
)
|
||||
log.Info("Emby client registration starting")
|
||||
|
||||
auth, err := s.emby.Authenticate(
|
||||
r.Context(), req.Username, req.Password,
|
||||
@@ -98,7 +105,7 @@ func (s *Server) handleLogin(w http.ResponseWriter, r *http.Request) {
|
||||
if err != nil {
|
||||
// Never echo Emby's body here: a failed sign-in is the one place a wrong
|
||||
// password could be reflected back.
|
||||
s.loggerFor(r.Context()).Warn("sign-in rejected",
|
||||
log.Warn("sign-in rejected",
|
||||
"username", req.Username, "device", req.DeviceName, "device_id", req.DeviceID,
|
||||
"reason", "emby refused the credentials",
|
||||
)
|
||||
@@ -179,6 +186,11 @@ func (s *Server) handleLogin(w http.ResponseWriter, r *http.Request) {
|
||||
if len(created.ReplacedHash) > 0 {
|
||||
_ = s.cache.Delete(r.Context(), cache.SessionKey(hexHash(created.ReplacedHash)))
|
||||
}
|
||||
log.Info("Emby client registration succeeded",
|
||||
"user", sess.Username,
|
||||
"user_id", sess.EmbyUserID,
|
||||
"replaced", len(created.ReplacedHash) > 0,
|
||||
)
|
||||
s.retireSupersededDevices(r.Context(), created.Superseded)
|
||||
// Recorded after the session exists, so a build history can only describe a
|
||||
// television that got as far as signing in.
|
||||
|
||||
Reference in New Issue
Block a user