mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
logs: add a specific log structure for successful logins
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -703,7 +703,7 @@ func handleDefenderEventLoginFailed(ipAddr string, err error) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func updateLoginMetrics(user *dataprovider.User, loginMethod, ip string, err error) {
|
||||
func updateLoginMetrics(user *dataprovider.User, loginMethod, ip string, err error, r *http.Request) {
|
||||
metric.AddLoginAttempt(loginMethod)
|
||||
var protocol string
|
||||
switch loginMethod {
|
||||
@@ -713,6 +713,7 @@ func updateLoginMetrics(user *dataprovider.User, loginMethod, ip string, err err
|
||||
protocol = common.ProtocolHTTP
|
||||
}
|
||||
if err == nil {
|
||||
logger.LoginLog(user.Username, ip, loginMethod, protocol, "", r.UserAgent(), r.TLS != nil, "")
|
||||
plugin.Handler.NotifyLogEvent(notifier.LogEventTypeLoginOK, protocol, user.Username, ip, "", nil)
|
||||
common.DelayLogin(nil)
|
||||
} else if err != common.ErrInternalFailure && err != common.ErrNoCredentials {
|
||||
|
||||
Reference in New Issue
Block a user