1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +00:00

6.3 perm error (#2294)

* Add login url to context

* [backbone] turn to login page when 403
This commit is contained in:
llj
2018-08-23 13:41:17 +08:00
committed by Daniel Pan
parent 5eba3e385e
commit ffca232d4d
4 changed files with 9 additions and 3 deletions

View File

@@ -110,6 +110,7 @@ def base(request):
'SITE_ROOT': SITE_ROOT,
'constance_enabled': dj_settings.CONSTANCE_ENABLED,
'FILE_SERVER_ROOT': file_server_root,
'LOGIN_URL': dj_settings.LOGIN_URL,
'enable_thumbnail': ENABLE_THUMBNAIL,
'thumbnail_size_for_original': THUMBNAIL_SIZE_FOR_ORIGINAL,
'enable_guest_invitation': ENABLE_GUEST_INVITATION,

View File

@@ -119,6 +119,7 @@ var app = {
config: {
mediaUrl: '{{ MEDIA_URL }}',
siteRoot: '{{ SITE_ROOT }}',
loginUrl: '{{ LOGIN_URL }}',
fileServerRoot: '{{ FILE_SERVER_ROOT }}'
}
};

View File

@@ -78,7 +78,8 @@
var app = {
config: {
mediaUrl: '{{ MEDIA_URL }}',
siteRoot: '{{ SITE_ROOT }}'
siteRoot: '{{ SITE_ROOT }}',
loginUrl: '{{ LOGIN_URL }}'
}
};
app["pageOptions"] = {

View File

@@ -454,10 +454,13 @@ define([
prepareCollectionFetchErrorMsg: function(collection, response, opts) {
var err_msg;
if (response.responseText) {
if (response['status'] == 401 || response['status'] == 403) {
if (response['status'] == 401) {
err_msg = gettext("Permission error");
} else if (response['status'] == 403) {
err_msg = gettext("Permission error");
location.href = app.config.loginUrl + '?next='
+ encodeURIComponent(location.pathname + location.hash);
} else {
//err_msg = gettext("Error");
err_msg = this.HTMLescape(JSON.parse(response.responseText).error_msg);
}
} else {