diff options
author | Unknwon <u@gogs.io> | 2015-09-10 15:45:03 -0400 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-09-10 15:45:03 -0400 |
commit | fa728d8dff2ddb8039efc2767f4fefb2d2f62004 (patch) | |
tree | 76290247b6605e4a41ccb3eff627863687a68019 /models | |
parent | 26ac016b9fb6b3fb308996e2ee56dad0b794aa49 (diff) | |
download | gitea-fa728d8dff2ddb8039efc2767f4fefb2d2f62004.tar.gz gitea-fa728d8dff2ddb8039efc2767f4fefb2d2f62004.zip |
more minor fix on 1581
Diffstat (limited to 'models')
-rw-r--r-- | models/login.go | 6 | ||||
-rw-r--r-- | models/models.go | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/models/login.go b/models/login.go index a7d07d50f4..527b763d26 100644 --- a/models/login.go +++ b/models/login.go @@ -134,6 +134,12 @@ func (source *LoginSource) PAM() *PAMConfig { return source.Cfg.(*PAMConfig) } +// CountLoginSources returns number of login sources. +func CountLoginSources() int64 { + count, _ := x.Count(new(LoginSource)) + return count +} + func CreateSource(source *LoginSource) error { _, err := x.Insert(source) return err diff --git a/models/models.go b/models/models.go index b8777e9f5a..67fa14149e 100644 --- a/models/models.go +++ b/models/models.go @@ -237,7 +237,7 @@ func GetStatistic() (stats Statistic) { stats.Counter.Follow, _ = x.Count(new(Follow)) stats.Counter.Mirror, _ = x.Count(new(Mirror)) stats.Counter.Release, _ = x.Count(new(Release)) - stats.Counter.LoginSource, _ = x.Count(new(LoginSource)) + stats.Counter.LoginSource = CountLoginSources() stats.Counter.Webhook, _ = x.Count(new(Webhook)) stats.Counter.Milestone, _ = x.Count(new(Milestone)) stats.Counter.Label, _ = x.Count(new(Label)) |