Commit 394c776a authored by Dave Lane's avatar Dave Lane

fix overzealous interference with link clicking hijacked by this plugin

parent ac616eae
......@@ -74,7 +74,8 @@ $dialog_definitions = array(
__('Problems? You can do a ', 'oeru-register-enrol').
'<a id="ore-passwordreset-auxillary-button" class="link ore-button" href="#passwordreset">'.
__('Password Reset', 'oeru-register-enrol').'</a>.<br/><br/><span class="ore-detail">'.
__('(The OERu encourages you to use "<a href="{{ore_data.password_manager}}">password manager</a>" software to store your passwords and help you create a strong and unique one for each website!)', 'oeru-register-enrol').
__('We encourage you to use "<a class="link ore-button" href="{{ore_data.password_manager}}">password manager</a>" software to store your passwords and help you create a strong and unique one for each website!', 'oeru-register-enrol').
__('Mobile users: beware when entering a password that your device might automatically <em>capitalise the first letter</em> of your password.', 'oeru-register-enrol').
'</span>'.
'</div>',
'default' => array(
......@@ -105,7 +106,9 @@ $dialog_definitions = array(
'title' => __('Login attempt failed', 'oeru-register-enrol'),
'token' => 'failed-login',
'purpose' => 'confirmation',
'markup' => '<p>'.__('You have entered an invalid username or email, or password. Or is it possible you have not yet created an account?', 'oeru-register-enrol').'</p>'.
'markup' => '<p>'.__('You have entered an invalid username or email, or password. Or is it possible you have not yet created an account?', 'oeru-register-enrol').'</p><p>'.
__('Mobile users: beware when entering a password that your device might automatically <em>capitalise the first letter</em> of your password.', 'oeru-register-enrol').'</p>'.
'<div id="ore-error-wrapper"></div>',
'default' => array(
'label' => __('Try again', 'oeru-register-enrol'),
......@@ -202,7 +205,9 @@ $dialog_definitions = array(
'<div class="form-group">'.
'<label for="password">'.__('Password', 'oeru-register-enrol').'</label>'.
'<input type="password" class="form-control" id="password" name="password" aria-describedby="helpPassword">'.
'<span id="helpPassword" class="help-block">'.__('At least 8 characters with a mix of lower and upper case letters, numbers, and symbols. Spaces are allowed. Your password is <em>case sensitive</em>.', 'oeru-register-enrol').'</span>'.
'<span id="helpPassword" class="help-block">'.__('At least 8 characters with a mix of lower and upper case letters, numbers, and symbols. Spaces are allowed. Your password is <em>case sensitive</em>.', 'oeru-register-enrol').
__('Mobile users: beware when entering a password that your device might automatically <em>capitalise the first letter</em> of your password.', 'oeru-register-enrol').
'</span>'.
'<label for="confirm-password">'.__('Confirm password', 'oeru-register-enrol').'</label>'.
'<input type="password" class="form-control" id="confirm-password" name="confirm-password" aria-describedby="helpConfirmPassword">'.
'<span id="helpConfirmPassword" class="help-block">'.__('This must be identical to the Password field.', 'oeru-register-enrol').
......@@ -337,7 +342,7 @@ $dialog_definitions = array(
'<span id="helpCurrentPassword" class="help-block">'.
__("Your current password, so that we can ensure you're you!<br/>If you can't remember your password, you can instead do a ").
'<a id="ore-passwordreset-auxillary-button" class="link ore-button" href="#passwordreset">'.
__('Password Reset', 'oeru-register-enrol').'</a><br/>'.__('(The OERu encourages you to use "password manager" software to store your passwords and help you create a strong and unique one for each website!)', 'oeru-register-enrol').'</span>'.
__('Password Reset', 'oeru-register-enrol').'</a><br/>'.__('(The OERu encourages you to use "<a class="link ore-button" href="{{ore_data.password_manager}}">password manager</a>" software to store your passwords and help you create a strong and unique one for each website!)', 'oeru-register-enrol').'</span>'.
'</div>'.
'<div class="form-group">'.
'<label for="new-password">'.__('New Password', 'oeru-register-enrol').'</label>'.
......
......@@ -507,19 +507,29 @@ jQuery(document).ready(function() {
}
});
// handle links
$(document).on('click', 'a', function(e) {
LOG('link click, event id ', e.currentTarget.id);
$(document).on('click', '.ore-dialog a.link', function(e) {
LOG('link click, event id ', e.target.id);
LOG('event target: ', e.target);
LOG('event target href: ', e.target.href);
current_focus = $(':focus');
var url = '';
if (e.target.hasOwnProperty('href')) {
LOG('grabbing the target href');
url = e.target.href;
} else {
LOG('grabbing the href from current_focus');
url = current_focus.attr('href');
}
if (current_focus.hasClass('ore-button')) {
action = action_from_id(e.currentTarget.id);
action = action_from_id(e.target.id);
LOG('executing action ', action);
busy();
handle_action(action);
not_busy();
} else {
LOG('just forwarding on the click...');
LOG('just forwarding on the click to ', url);
e.preventDefault();
window.open(current_focus.attr('href'));
window.open(url);
}
});
......@@ -548,6 +558,8 @@ jQuery(document).ready(function() {
LOG('our trigger is focused');
} else if (current_focus.hasClass('ore-button')) {
LOG('a button is focused');
} else {
LOG('neither a button nor trigger descendant is in focus.');
}
current_focus.click();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment