Improve login failure analytics
This commit is contained in:
parent
2a3acbff1b
commit
bbfb5e7b5b
2 changed files with 5 additions and 2 deletions
|
@ -504,12 +504,13 @@ Loop:
|
||||||
jsonResponse(w, http.StatusOK, LoginResponse{Status: "qr", Code: item.qr})
|
jsonResponse(w, http.StatusOK, LoginResponse{Status: "qr", Code: item.qr})
|
||||||
case item.err != nil:
|
case item.err != nil:
|
||||||
log.Err(item.err).Msg("Got error in QR channel")
|
log.Err(item.err).Msg("Got error in QR channel")
|
||||||
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "qr"})
|
|
||||||
var resp LoginResponse
|
var resp LoginResponse
|
||||||
switch {
|
switch {
|
||||||
case errors.Is(item.err, ErrLoginTimeout):
|
case errors.Is(item.err, ErrLoginTimeout):
|
||||||
|
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "qr", "error": "user timeout"})
|
||||||
resp = LoginResponse{ErrCode: "timeout", Error: "Scanning QR code timed out"}
|
resp = LoginResponse{ErrCode: "timeout", Error: "Scanning QR code timed out"}
|
||||||
default:
|
default:
|
||||||
|
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "qr", "error": "unknown"})
|
||||||
resp = LoginResponse{ErrCode: "unknown", Error: "Login failed"}
|
resp = LoginResponse{ErrCode: "unknown", Error: "Login failed"}
|
||||||
}
|
}
|
||||||
resp.Status = "fail"
|
resp.Status = "fail"
|
||||||
|
|
4
user.go
4
user.go
|
@ -568,7 +568,9 @@ func (user *User) LoginGoogle(ctx context.Context, cookies map[string]string, em
|
||||||
case errors.Is(err, libgm.ErrPairingCancelled):
|
case errors.Is(err, libgm.ErrPairingCancelled):
|
||||||
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "google", "error": "cancelled"})
|
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "google", "error": "cancelled"})
|
||||||
case errors.Is(err, libgm.ErrPairingTimeout):
|
case errors.Is(err, libgm.ErrPairingTimeout):
|
||||||
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "google", "error": "timeout"})
|
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "google", "error": "user timeout"})
|
||||||
|
case errors.Is(err, libgm.ErrPairingInitTimeout):
|
||||||
|
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "google", "error": "init timeout"})
|
||||||
default:
|
default:
|
||||||
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "google", "error": "unknown"})
|
Analytics.Track(user.MXID, "$login_failure", map[string]any{"mode": "google", "error": "unknown"})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue