Fix All() for postgres store

This commit is contained in:
Torjus Håkestad 2021-09-17 15:00:47 +02:00
parent a76a95b300
commit b371dca158

View File

@ -73,9 +73,11 @@ func (s *PostgresStore) All() ([]models.LoginAttempt, error) {
var attempts []models.LoginAttempt var attempts []models.LoginAttempt
for rows.Next() { for rows.Next() {
var a models.LoginAttempt var a models.LoginAttempt
if err := rows.Scan(&a.Date, &a.RemoteIP, &a.Username, &a.Password, &a.SSHClientVersion, &a.SSHClientVersion, &a.Country); err != nil { var ip string
if err := rows.Scan(&a.Date, &ip, &a.Username, &a.Password, &a.SSHClientVersion, &a.SSHClientVersion, &a.Country); err != nil {
return nil, err return nil, err
} }
a.RemoteIP = net.ParseIP(ip)
attempts = append(attempts, a) attempts = append(attempts, a)
} }