* Change logout to POST * Update for redirect * Revert octicon to font Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
e4a876cee1
commit
6f5656ab0e
4 changed files with 6 additions and 3 deletions
|
@ -14,7 +14,7 @@ func TestSignOut(t *testing.T) {
|
||||||
|
|
||||||
session := loginUser(t, "user2")
|
session := loginUser(t, "user2")
|
||||||
|
|
||||||
req := NewRequest(t, "GET", "/user/logout")
|
req := NewRequest(t, "POST", "/user/logout")
|
||||||
session.MakeRequest(t, req, http.StatusFound)
|
session.MakeRequest(t, req, http.StatusFound)
|
||||||
|
|
||||||
// try to view a private repo, should fail
|
// try to view a private repo, should fail
|
||||||
|
|
|
@ -399,7 +399,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||||
m.Post("/recover_account", user.ResetPasswdPost)
|
m.Post("/recover_account", user.ResetPasswdPost)
|
||||||
m.Get("/forgot_password", user.ForgotPasswd)
|
m.Get("/forgot_password", user.ForgotPasswd)
|
||||||
m.Post("/forgot_password", user.ForgotPasswdPost)
|
m.Post("/forgot_password", user.ForgotPasswdPost)
|
||||||
m.Get("/logout", user.SignOut)
|
m.Post("/logout", user.SignOut)
|
||||||
})
|
})
|
||||||
// ***** END: User *****
|
// ***** END: User *****
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<a class="item" href="{{AppSubUrl}}/user/logout">
|
<a class="item link-action" href data-url="{{AppSubUrl}}/user/logout" data-redirect="{{AppSubUrl}}/">
|
||||||
<i class="octicon octicon-sign-out"></i>
|
<i class="octicon octicon-sign-out"></i>
|
||||||
{{.i18n.Tr "sign_out"}}<!-- Sign Out -->
|
{{.i18n.Tr "sign_out"}}<!-- Sign Out -->
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -2740,11 +2740,14 @@ function showAddAllPopup() {
|
||||||
|
|
||||||
function linkAction() {
|
function linkAction() {
|
||||||
const $this = $(this);
|
const $this = $(this);
|
||||||
|
const redirect = $this.data('redirect');
|
||||||
$.post($this.data('url'), {
|
$.post($this.data('url'), {
|
||||||
_csrf: csrf
|
_csrf: csrf
|
||||||
}).done((data) => {
|
}).done((data) => {
|
||||||
if (data.redirect) {
|
if (data.redirect) {
|
||||||
window.location.href = data.redirect;
|
window.location.href = data.redirect;
|
||||||
|
} else if (redirect) {
|
||||||
|
window.location.href = redirect;
|
||||||
} else {
|
} else {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue