MCPcopy Index your code
hub / github.com/1Panel-dev/KubePi / SaveLoginLog

Method SaveLoginLog

internal/api/v1/session/session.go:280–287  ·  view source on GitHub ↗
(ctx *context.Context, userName string)

Source from the content-addressed store, hash-verified

278}
279
280func (h *Handler) SaveLoginLog(ctx *context.Context, userName string) {
281 var logItem v1System.LoginLog
282 logItem.UserName = userName
283 logItem.Ip = normalizeLoginIP(ctx.RemoteAddr())
284 logItem.City = getLoginIPArea(logItem.Ip)
285 systemService := v1SystemService.NewService()
286 systemService.CreateLoginLog(&logItem, common.DBOptions{})
287}
288
289func normalizeLoginIP(remoteAddr string) string {
290 ipValue := strings.TrimSpace(remoteAddr)

Callers 3

CallbackOpenIDMethod · 0.95
Saml2AuthMethod · 0.95
LoginMethod · 0.95

Calls 3

CreateLoginLogMethod · 0.95
normalizeLoginIPFunction · 0.85
getLoginIPAreaFunction · 0.85

Tested by

no test coverage detected