fix(uoj/1/app/controllers): fix login failure loop when logout from user profile modify page

When logout by clicking logout button on the top of /user/modify-profile link, you will be redirected to the login page.
But if you login immediately then you will get the login page again and loop.
It is caused by an address checking error. Now try to fix.
This commit is contained in:
Masco Skray 2018-09-23 23:14:39 +08:00
parent b7c10c82c3
commit 1d72c5e914

View File

@ -89,7 +89,7 @@ function submitLoginPost() {
}, function(msg) {
if (msg == 'ok') {
var prevUrl = document.referrer;
if (prevUrl == '' || /.*\/login.*/.test(prevUrl) || /.*\/register.*/.test(prevUrl) || /.*\/reset-password.*/.test(prevUrl)) {
if (prevUrl == '' || /.*\/login.*/.test(prevUrl) || /.*\/logout.*/.test(prevUrl) || /.*\/register.*/.test(prevUrl) || /.*\/reset-password.*/.test(prevUrl)) {
prevUrl = '/';
};
window.location.href = prevUrl;