diff options
author | Unknwon <u@gogs.io> | 2016-08-31 01:22:41 -0700 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2016-08-31 01:22:41 -0700 |
commit | 152e715999bfec9859423034aec3df90442961f1 (patch) | |
tree | 8454c6460e7f54b8f84b0e7b83864224a94df15a /routers | |
parent | 99c2ae7b355556776f0a2231a3173a0c554e9ffe (diff) | |
download | gitea-152e715999bfec9859423034aec3df90442961f1.tar.gz gitea-152e715999bfec9859423034aec3df90442961f1.zip |
models/login_source: code improvement
Diffstat (limited to 'routers')
-rw-r--r-- | routers/admin/auths.go | 5 |
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{}{ |