mirror of https://github.com/go-gitea/gitea.git
Use JSON response for "user/logout" (#25522)
The request sent to "user/logout" is from "link-action", it expects to get JSON response.
This commit is contained in:
parent
da6df0d063
commit
ddf96f68cc
|
@ -383,7 +383,7 @@ func SignOut(ctx *context.Context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
HandleSignOut(ctx)
|
HandleSignOut(ctx)
|
||||||
ctx.Redirect(setting.AppSubURL + "/")
|
ctx.JSONRedirect(setting.AppSubURL + "/")
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignUp render the register page
|
// SignUp render the register page
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout" data-redirect="{{AppSubUrl}}/">
|
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout">
|
||||||
{{svg "octicon-sign-out"}}
|
{{svg "octicon-sign-out"}}
|
||||||
{{.locale.Tr "sign_out"}}
|
{{.locale.Tr "sign_out"}}
|
||||||
</a>
|
</a>
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout" data-redirect="{{AppSubUrl}}/">
|
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout">
|
||||||
{{svg "octicon-sign-out"}}
|
{{svg "octicon-sign-out"}}
|
||||||
{{.locale.Tr "sign_out"}}
|
{{.locale.Tr "sign_out"}}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -16,7 +16,7 @@ func TestSignOut(t *testing.T) {
|
||||||
session := loginUser(t, "user2")
|
session := loginUser(t, "user2")
|
||||||
|
|
||||||
req := NewRequest(t, "POST", "/user/logout")
|
req := NewRequest(t, "POST", "/user/logout")
|
||||||
session.MakeRequest(t, req, http.StatusSeeOther)
|
session.MakeRequest(t, req, http.StatusOK)
|
||||||
|
|
||||||
// try to view a private repo, should fail
|
// try to view a private repo, should fail
|
||||||
req = NewRequest(t, "GET", "/user2/repo2")
|
req = NewRequest(t, "GET", "/user2/repo2")
|
||||||
|
|
Loading…
Reference in New Issue