Skip to content

Commit 06a1739

Browse files
lunnytechknowlogick
authored andcommitted
fix bug when deleting a linked account will removed all (go-gitea#5989)
1 parent 9dfdf80 commit 06a1739

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

routers/user/setting/security.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ func Security(ctx *context.Context) {
3434

3535
// DeleteAccountLink delete a single account link
3636
func DeleteAccountLink(ctx *context.Context) {
37-
if _, err := models.RemoveAccountLink(ctx.User, ctx.QueryInt64("loginSourceID")); err != nil {
38-
ctx.Flash.Error("RemoveAccountLink: " + err.Error())
37+
id := ctx.QueryInt64("id")
38+
if id <= 0 {
39+
ctx.Flash.Error("Account link id is not given")
3940
} else {
40-
ctx.Flash.Success(ctx.Tr("settings.remove_account_link_success"))
41+
if _, err := models.RemoveAccountLink(ctx.User, id); err != nil {
42+
ctx.Flash.Error("RemoveAccountLink: " + err.Error())
43+
} else {
44+
ctx.Flash.Success(ctx.Tr("settings.remove_account_link_success"))
45+
}
4146
}
4247

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

0 commit comments

Comments
 (0)