mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
6.3 perm error (#2294)
* Add login url to context * [backbone] turn to login page when 403
This commit is contained in:
@@ -110,6 +110,7 @@ def base(request):
|
|||||||
'SITE_ROOT': SITE_ROOT,
|
'SITE_ROOT': SITE_ROOT,
|
||||||
'constance_enabled': dj_settings.CONSTANCE_ENABLED,
|
'constance_enabled': dj_settings.CONSTANCE_ENABLED,
|
||||||
'FILE_SERVER_ROOT': file_server_root,
|
'FILE_SERVER_ROOT': file_server_root,
|
||||||
|
'LOGIN_URL': dj_settings.LOGIN_URL,
|
||||||
'enable_thumbnail': ENABLE_THUMBNAIL,
|
'enable_thumbnail': ENABLE_THUMBNAIL,
|
||||||
'thumbnail_size_for_original': THUMBNAIL_SIZE_FOR_ORIGINAL,
|
'thumbnail_size_for_original': THUMBNAIL_SIZE_FOR_ORIGINAL,
|
||||||
'enable_guest_invitation': ENABLE_GUEST_INVITATION,
|
'enable_guest_invitation': ENABLE_GUEST_INVITATION,
|
||||||
|
@@ -119,6 +119,7 @@ var app = {
|
|||||||
config: {
|
config: {
|
||||||
mediaUrl: '{{ MEDIA_URL }}',
|
mediaUrl: '{{ MEDIA_URL }}',
|
||||||
siteRoot: '{{ SITE_ROOT }}',
|
siteRoot: '{{ SITE_ROOT }}',
|
||||||
|
loginUrl: '{{ LOGIN_URL }}',
|
||||||
fileServerRoot: '{{ FILE_SERVER_ROOT }}'
|
fileServerRoot: '{{ FILE_SERVER_ROOT }}'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -78,7 +78,8 @@
|
|||||||
var app = {
|
var app = {
|
||||||
config: {
|
config: {
|
||||||
mediaUrl: '{{ MEDIA_URL }}',
|
mediaUrl: '{{ MEDIA_URL }}',
|
||||||
siteRoot: '{{ SITE_ROOT }}'
|
siteRoot: '{{ SITE_ROOT }}',
|
||||||
|
loginUrl: '{{ LOGIN_URL }}'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
app["pageOptions"] = {
|
app["pageOptions"] = {
|
||||||
|
@@ -454,10 +454,13 @@ define([
|
|||||||
prepareCollectionFetchErrorMsg: function(collection, response, opts) {
|
prepareCollectionFetchErrorMsg: function(collection, response, opts) {
|
||||||
var err_msg;
|
var err_msg;
|
||||||
if (response.responseText) {
|
if (response.responseText) {
|
||||||
if (response['status'] == 401 || response['status'] == 403) {
|
if (response['status'] == 401) {
|
||||||
err_msg = gettext("Permission error");
|
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 {
|
} else {
|
||||||
//err_msg = gettext("Error");
|
|
||||||
err_msg = this.HTMLescape(JSON.parse(response.responseText).error_msg);
|
err_msg = this.HTMLescape(JSON.parse(response.responseText).error_msg);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user