mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-03-30 23:37:05 +00:00
Merge remote-tracking branch 'upstream/main' into sync-upstream
This commit is contained in:
commit
416257893f
@ -549,10 +549,13 @@ def list_target_files(config):
|
||||
|
||||
# connect to the region & bucket
|
||||
try:
|
||||
s3 = boto3.client('s3', \
|
||||
endpoint_url=f'https://{target.hostname}', \
|
||||
aws_access_key_id=config['target_user'], \
|
||||
aws_secret_access_key=config['target_pass'])
|
||||
if config['target_user'] == "" and config['target_pass'] == "":
|
||||
s3 = boto3.client('s3', endpoint_url=f'https://{target.hostname}')
|
||||
else:
|
||||
s3 = boto3.client('s3', \
|
||||
endpoint_url=f'https://{target.hostname}', \
|
||||
aws_access_key_id=config['target_user'], \
|
||||
aws_secret_access_key=config['target_pass'])
|
||||
bucket_objects = s3.list_objects_v2(Bucket=bucket, Prefix=path)['Contents']
|
||||
backup_list = [(key['Key'][len(path):], key['Size']) for key in bucket_objects]
|
||||
except ClientError as e:
|
||||
|
@ -398,7 +398,9 @@ function api(url, method, data, callback, callback_error, headers) {
|
||||
403: function(xhr) {
|
||||
// Credentials are no longer valid. Try to login again.
|
||||
var p = current_panel;
|
||||
clear_credentials();
|
||||
show_panel('login');
|
||||
show_hide_menus();
|
||||
switch_back_to_panel = p;
|
||||
}
|
||||
}
|
||||
@ -408,16 +410,21 @@ function api(url, method, data, callback, callback_error, headers) {
|
||||
var current_panel = null;
|
||||
var switch_back_to_panel = null;
|
||||
|
||||
function do_logout() {
|
||||
// Clear the session from the backend.
|
||||
api("/logout", "POST");
|
||||
|
||||
function clear_credentials() {
|
||||
// Forget the token.
|
||||
api_credentials = null;
|
||||
if (typeof localStorage != 'undefined')
|
||||
localStorage.removeItem("miab-cp-credentials");
|
||||
if (typeof sessionStorage != 'undefined')
|
||||
sessionStorage.removeItem("miab-cp-credentials");
|
||||
}
|
||||
|
||||
function do_logout() {
|
||||
// Clear the session from the backend.
|
||||
api("/logout", "POST");
|
||||
|
||||
// Remove locally stored credentials
|
||||
clear_credentials();
|
||||
|
||||
// Return to the start.
|
||||
show_panel('login');
|
||||
|
Loading…
Reference in New Issue
Block a user