models/login_source: code improvement

This commit is contained in:
Unknwon 2016-08-31 01:22:41 -07:00
parent 99c2ae7b35
commit 152e715999
6 changed files with 131 additions and 134 deletions

View file

@ -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{}{