summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-08-31 01:22:41 -0700
committerUnknwon <u@gogs.io>2016-08-31 01:22:41 -0700
commit152e715999bfec9859423034aec3df90442961f1 (patch)
tree8454c6460e7f54b8f84b0e7b83864224a94df15a /routers
parent99c2ae7b355556776f0a2231a3173a0c554e9ffe (diff)
downloadgitea-152e715999bfec9859423034aec3df90442961f1.tar.gz
gitea-152e715999bfec9859423034aec3df90442961f1.zip
models/login_source: code improvement
Diffstat (limited to 'routers')
-rw-r--r--routers/admin/auths.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/routers/admin/auths.go b/routers/admin/auths.go
index 8d3304eacf..df2512aa06 100644
--- a/routers/admin/auths.go
+++ b/routers/admin/auths.go
@@ -242,10 +242,9 @@ func DeleteAuthSource(ctx *context.Context) {
}
if err = models.DeleteSource(source); err != nil {
- switch err {
- case models.ErrAuthenticationUserUsed:
+ if models.IsErrLoginSourceInUse(err) {
ctx.Flash.Error(ctx.Tr("admin.auths.still_in_used"))
- default:
+ } else {
ctx.Flash.Error(fmt.Sprintf("DeleteSource: %v", err))
}
ctx.JSON(200, map[string]interface{}{