summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-09-10 15:45:03 -0400
committerUnknwon <u@gogs.io>2015-09-10 15:45:03 -0400
commitfa728d8dff2ddb8039efc2767f4fefb2d2f62004 (patch)
tree76290247b6605e4a41ccb3eff627863687a68019 /models
parent26ac016b9fb6b3fb308996e2ee56dad0b794aa49 (diff)
downloadgitea-fa728d8dff2ddb8039efc2767f4fefb2d2f62004.tar.gz
gitea-fa728d8dff2ddb8039efc2767f4fefb2d2f62004.zip
more minor fix on 1581
Diffstat (limited to 'models')
-rw-r--r--models/login.go6
-rw-r--r--models/models.go2
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))