Skip to content

Commit

Permalink
show IP on warning log when user pass is not correct (#2607)
Browse files Browse the repository at this point in the history
  • Loading branch information
lexnake3 authored Dec 3, 2024
1 parent b859327 commit 749a426
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web/controller/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (a *IndexController) login(c *gin.Context) {
safePass := template.HTMLEscapeString(form.Password)
safeSecret := template.HTMLEscapeString(form.LoginSecret)
if user == nil {
logger.Warningf("wrong username or password or secret: \"%s\" \"%s\" \"%s\"", safeUser, safePass, safeSecret)
logger.Warningf("wrong username: \"%s\", password: \"%s\", secret: \"%s\", IP: \"%s\"", safeUser, safePass, safeSecret, getRemoteIp(c))
a.tgbot.UserLoginNotify(safeUser, safePass, getRemoteIp(c), timeStr, 0)
pureJsonMsg(c, http.StatusOK, false, I18nWeb(c, "pages.login.toasts.wrongUsernameOrPassword"))
return
Expand Down

1 comment on commit 749a426

@power0matin
Copy link

@power0matin power0matin commented on 749a426 Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

سلام،

مشکل اینه که به جای آی‌پی واقعی کاربر، آی‌پی 127.0.0.1 به بات تلگرام ارسال میشه. این به دلیل اینه که تابع getRemoteIp(c) آی‌پی واقعی رو به درستی شناسایی نمی‌کنه، مخصوصاً وقتی سرور پشت پروکسی قرار داره.

Image

Please sign in to comment.