(ctx *context.Context, userName string)
| 278 | } |
| 279 | |
| 280 | func (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 | |
| 289 | func normalizeLoginIP(remoteAddr string) string { |
| 290 | ipValue := strings.TrimSpace(remoteAddr) |
no test coverage detected