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,16 +627,18 @@ if(!window.registrationsClosed) {
});
// validate on keyup
$('#popup-register input').on('keyup',function(){
if(validateRegisterForm($('#popup-register'))
&& !$('#signup-user-nickname-step2').hasClass('nickname-taken')
&& !$('#signup-user-email-step2').hasClass('email-in-use')) {
$('#signup-btn-step2').removeClass('disabled');
}
else {
$('#signup-btn-step2').addClass('disabled');
}
// validate on keyup / paste / blur
$('#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'))
&& !$('#signup-user-nickname-step2').hasClass('nickname-taken')
&& !$('#signup-user-email-step2').hasClass('email-in-use')) {
$('#signup-btn-step2').removeClass('disabled');
}
else {
$('#signup-btn-step2').addClass('disabled');
}
}, 0);
});
$('#popup-register input').trigger('keyup');