Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-ide committed Sep 30, 2024
2 parents 741940b + b532109 commit 2835edf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 1 addition & 7 deletions webapp/auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,15 @@ def login():
else:
return redirect(url_for(PAGE_INDEX))

# log_info(f"request.url: {request.url}")
# if request.method == 'GET':
# log_info(f"GET: request.args: {request.args.to_dict()}")
# else:
# log_info(f"POST: request.form: {request.form.to_dict()}")

# Process POST
form = LoginForm()
if form.validate_on_submit():
username = form.username.data
if not is_whitelisted_username(username):
flash(f'Username {username} is not authorized to log in to this server. Please contact '
'[email protected] if you believe you need access to this server.', 'error')
log_error(f'Non-whitelisted login attempt by {username}')
return redirect(url_for(PAGE_LOGIN))
# domain = form.domain.data # Never None
domain = "edi"
user_dn = 'uid=' + form.username.data + ',' + Config.DOMAINS[domain]
password = form.password.data
Expand Down
10 changes: 9 additions & 1 deletion webapp/views/data_tables/templates/clone_attributes_4.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@
select_default(this.id);
});
}
function escapeSelector(selector) {
// There are a few characters that need to be escaped in a jQuery selector so they aren't interpreted as
// class selectors and the like. This function escapes those characters.
return selector.replace(/([!"#$%&'()*+,.\/:;<=>?@[\\\]^`{|}~])/g, '\\$1');
}
function select_default(_select_id) {
// We need to replace spaces with underscores in the SELECT id for jQuery to work properly
let select_id = _select_id.replace(/ /g, '_');
let selector = '#' + select_id + ' option';
// Get rid of SELECT__ and __SELECT substrings
let default_val = select_id.substring(8, select_id.length - 8);
// jQuery interprets '.' as a class selector, so we need to escape '.' with '\\'.
// There are various other chars that may be similarly problematic. We'll escape them all.
select_id = escapeSelector(select_id);
let selector = '#' + select_id + ' option';
$(selector).filter(function() {
let this_text = $(this).text().replace(/ /g, '_');
return this_text === default_val;
Expand Down

0 comments on commit 2835edf

Please sign in to comment.