mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
Added redirection to previous page after logout
This commit is contained in:
parent
195effd177
commit
8a896f196c
2 changed files with 7 additions and 2 deletions
|
@ -17,7 +17,7 @@ func (a *BaseController) checkLogin(c *gin.Context) {
|
||||||
if isAjax(c) {
|
if isAjax(c) {
|
||||||
pureJsonMsg(c, http.StatusUnauthorized, false, I18nWeb(c, "pages.login.loginAgain"))
|
pureJsonMsg(c, http.StatusUnauthorized, false, I18nWeb(c, "pages.login.loginAgain"))
|
||||||
} else {
|
} else {
|
||||||
c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path"))
|
c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path") + "?redirect=" + c.FullPath())
|
||||||
}
|
}
|
||||||
c.Abort()
|
c.Abort()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -502,8 +502,13 @@
|
||||||
const msg = await HttpUtil.post('/login', this.user);
|
const msg = await HttpUtil.post('/login', this.user);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
|
const redirect = new URLSearchParams(location.search).get('redirect');
|
||||||
|
if (redirect && redirect.startsWith('/')) {
|
||||||
|
location.href = redirect;
|
||||||
|
} else {
|
||||||
location.href = basePath + 'panel/';
|
location.href = basePath + 'panel/';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
async getSecretStatus() {
|
async getSecretStatus() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
Loading…
Reference in a new issue