Skip to content

Commit

Permalink
fix bug when deleting a linked account will removed all (go-gitea#5989)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Feb 7, 2019
1 parent 6416f06 commit 6719438
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions routers/user/setting/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ func Security(ctx *context.Context) {

// DeleteAccountLink delete a single account link
func DeleteAccountLink(ctx *context.Context) {
if _, err := models.RemoveAccountLink(ctx.User, ctx.QueryInt64("loginSourceID")); err != nil {
ctx.Flash.Error("RemoveAccountLink: " + err.Error())
id := ctx.QueryInt64("id")
if id <= 0 {
ctx.Flash.Error("Account link id is not given")
} else {
ctx.Flash.Success(ctx.Tr("settings.remove_account_link_success"))
if _, err := models.RemoveAccountLink(ctx.User, id); err != nil {
ctx.Flash.Error("RemoveAccountLink: " + err.Error())
} else {
ctx.Flash.Success(ctx.Tr("settings.remove_account_link_success"))
}
}

ctx.JSON(200, map[string]interface{}{
Expand Down

0 comments on commit 6719438

Please sign in to comment.