summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-02-07 14:51:23 +0800
committertechknowlogick <matti@mdranta.net>2019-02-07 01:51:23 -0500
commit06a17395530bdda809060442b5bb230edfa216f3 (patch)
tree2229365807f9cad9d3a5d97d8f1d5dd7366a11f5 /routers
parent9dfdf80af08cee3b2f0297843084fe14e3af31e7 (diff)
downloadgitea-06a17395530bdda809060442b5bb230edfa216f3.tar.gz
gitea-06a17395530bdda809060442b5bb230edfa216f3.zip
fix bug when deleting a linked account will removed all (#5989)
Diffstat (limited to 'routers')
-rw-r--r--routers/user/setting/security.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/routers/user/setting/security.go b/routers/user/setting/security.go
index 862e4413c7..f8f5cc0cd8 100644
--- a/routers/user/setting/security.go
+++ b/routers/user/setting/security.go
@@ -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{}{