Attempt to fix postgres stats
This commit is contained in:
parent
af6b022932
commit
735114edbd
@ -97,6 +97,8 @@ func (s *PostgresStore) Stats(statType LoginStats, limit int) ([]StatsResult, er
|
|||||||
stmt = `select password, count(password) from login_attempts group by password order by count desc`
|
stmt = `select password, count(password) from login_attempts group by password order by count desc`
|
||||||
case LoginStatsUsername:
|
case LoginStatsUsername:
|
||||||
stmt = `select username, count(username) from login_attempts group by username order by count desc`
|
stmt = `select username, count(username) from login_attempts group by username order by count desc`
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("invalid stat type")
|
||||||
}
|
}
|
||||||
|
|
||||||
if limit > 0 {
|
if limit > 0 {
|
||||||
|
@ -8,9 +8,9 @@ const (
|
|||||||
LoginStatsUndefined LoginStats = ""
|
LoginStatsUndefined LoginStats = ""
|
||||||
LoginStatsPasswords LoginStats = "password"
|
LoginStatsPasswords LoginStats = "password"
|
||||||
LoginStatsCountry LoginStats = "country"
|
LoginStatsCountry LoginStats = "country"
|
||||||
LoginStatsIP LoginStats = "ips"
|
LoginStatsIP LoginStats = "ip"
|
||||||
LoginStatsUsername LoginStats = "username"
|
LoginStatsUsername LoginStats = "username"
|
||||||
LoginStatsTotals LoginStats = "totals"
|
LoginStatsTotals LoginStats = "total"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StatsResult struct {
|
type StatsResult struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user