make redirect conditional on previous view

This commit is contained in:
Andrew Bauer 2020-10-12 10:32:25 -05:00
parent 3646a66168
commit 0f263407a5
4 changed files with 5 additions and 5 deletions

View File

@ -23,7 +23,7 @@ if ( $action == 'logout' ) {
userLogout();
$view = 'login';
} elseif ( $action == 'config' ) {
$redirect = '?view=user&uid='.$user['Id'];
$redirect = '?view=user&prev=console&uid='.$user['Id'];
}
?>

View File

@ -66,9 +66,7 @@ if ( $action == 'Save' ) {
} else {
dbQuery('INSERT INTO Users SET '.implode(', ', $changes));
}
$refreshParent = true;
} # end if changes
$redirect = '?view=options&tab=users';
} else if ( ZM_USER_SELF_EDIT and ( $_REQUEST['uid'] == $user['Id'] ) ) {
$uid = $user['Id'];
@ -99,9 +97,7 @@ if ( $action == 'Save' ) {
zm_session_start();
generateAuthHash(ZM_AUTH_HASH_IPS, true);
session_write_close();
$refreshParent = true;
}
$redirect = '?view=options&tab=users';
}
} // end if $action == user
?>

View File

@ -183,6 +183,9 @@ $user = null;
if ( isset($_REQUEST['view']) )
$view = detaintPath($_REQUEST['view']);
if ( isset($_REQUEST['redirect']) )
$redirect = '?view='.detaintPath($_REQUEST['redirect']);
# Add CSP Headers
$cspNonce = bin2hex(zm_random_bytes(16));

View File

@ -69,6 +69,7 @@ xhtmlHeaders(__FILE__, translate('User').' - '.$newUser->Username());
</div>
<div id="content" class="row justify-content-center">
<form id="contentForm" name="contentForm" method="post" action="?view=user">
<input type="hidden" name="redirect" value="<?php echo isset($_REQUEST['prev']) ? $_REQUEST['prev'] : 'options&tab=users' ?>"/>
<input type="hidden" name="uid" value="<?php echo validHtmlStr($_REQUEST['uid']) ?>"/>
<table id="contentTable" class="table">
<tbody>