diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-07-03 22:53:45 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2024-07-03 22:53:45 +0300 |
| commit | 21b64beb96264dfbee8b3c855effe87f7aeb5d12 (patch) | |
| tree | 9dae50105293e1dd0d339795ee6cca23a5ac5dc2 /web/controller/index.go | |
| parent | b84e3ef33812e829078a8661da57f020438bcf6b (diff) | |
tgbot - login notify (show password for failed login)
Diffstat (limited to 'web/controller/index.go')
| -rw-r--r-- | web/controller/index.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/web/controller/index.go b/web/controller/index.go index bc3c4204..fc5480c4 100644 --- a/web/controller/index.go +++ b/web/controller/index.go @@ -65,13 +65,13 @@ func (a *IndexController) login(c *gin.Context) { user := a.userService.CheckUser(form.Username, form.Password, form.LoginSecret) timeStr := time.Now().Format("2006-01-02 15:04:05") if user == nil { - logger.Warningf("wrong username or password: \"%s\" \"%s\"", form.Username, form.Password) - a.tgbot.UserLoginNotify(form.Username, getRemoteIp(c), timeStr, 0) + logger.Warningf("wrong username or password or secret: \"%s\" \"%s\" \"%s\"", form.Username, form.Password, form.LoginSecret) + a.tgbot.UserLoginNotify(form.Username, form.Password, getRemoteIp(c), timeStr, 0) pureJsonMsg(c, http.StatusOK, false, I18nWeb(c, "pages.login.toasts.wrongUsernameOrPassword")) return } else { - logger.Infof("%s login success, Ip Address: %s\n", form.Username, getRemoteIp(c)) - a.tgbot.UserLoginNotify(form.Username, getRemoteIp(c), timeStr, 1) + logger.Infof("%s Successful Login, Ip Address: %s\n", form.Username, getRemoteIp(c)) + a.tgbot.UserLoginNotify(form.Username, ``, getRemoteIp(c), timeStr, 1) } sessionMaxAge, err := a.settingService.GetSessionMaxAge() @@ -87,14 +87,14 @@ func (a *IndexController) login(c *gin.Context) { } err = session.SetLoginUser(c, user) - logger.Info("user", user.Id, "login success") + logger.Info("user ", user.Id, " login success") jsonMsg(c, I18nWeb(c, "pages.login.toasts.successLogin"), err) } func (a *IndexController) logout(c *gin.Context) { user := session.GetLoginUser(c) if user != nil { - logger.Info("user", user.Id, "logout") + logger.Info("user ", user.Id, " logout") } session.ClearSession(c) c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path")) |
