Merge branch 'master' into 'master'

Fix: Better support for pasting passwords and using password managers

During registration users complained about valid passwords shown as invalid. The reasons were them pasting the passwords via middle click (on Linux) or using e.g. pwdhash (password manager for Firefox) which do not trigger the keyup event. As a fix I added listening to the paste and blur events and deferred the validation as the paste event will be triggered before the input is updated.

See merge request !57
This commit is contained in:
hannes 2016-05-10 06:01:09 -04:00
commit 5202fda5c8

View File

@ -627,8 +627,9 @@ if(!window.registrationsClosed) {
}); });
// validate on keyup // validate on keyup / paste / blur
$('#popup-register input').on('keyup',function(){ $('#popup-register input').on('keyup paste blur',function(){
setTimeout(function () { // defer validation as after paste the content is not immediately available
if(validateRegisterForm($('#popup-register')) if(validateRegisterForm($('#popup-register'))
&& !$('#signup-user-nickname-step2').hasClass('nickname-taken') && !$('#signup-user-nickname-step2').hasClass('nickname-taken')
&& !$('#signup-user-email-step2').hasClass('email-in-use')) { && !$('#signup-user-email-step2').hasClass('email-in-use')) {
@ -637,6 +638,7 @@ if(!window.registrationsClosed) {
else { else {
$('#signup-btn-step2').addClass('disabled'); $('#signup-btn-step2').addClass('disabled');
} }
}, 0);
}); });
$('#popup-register input').trigger('keyup'); $('#popup-register input').trigger('keyup');