Redirect to index when logged out via the Control Panel #5

This commit is contained in:
Azareal 2018-05-11 16:18:49 +10:00
parent ed4a90f138
commit 73c4f373e5
1 changed files with 7 additions and 2 deletions

View File

@ -1890,9 +1890,14 @@ func routePanelUsersEditSubmit(w http.ResponseWriter, r *http.Request, user comm
// Log the user out as a safety precaution
common.Auth.ForceLogout(targetUser.ID)
}
targetUser.CacheRemove()
// If we're changing our own password, redirect to the index rather than to a noperms error due to the force logout
if targetUser.ID == user.ID {
http.Redirect(w, r, "/", http.StatusSeeOther)
} else {
http.Redirect(w, r, "/panel/users/edit/"+strconv.Itoa(targetUser.ID)+"?updated=1", http.StatusSeeOther)
}
return nil
}