/** * Password plugin script * * @licstart The following is the entire license notice for the * JavaScript code in this file. * * Copyright (c) 2012-2014, The Roundcube Dev Team * * The JavaScript code in this page is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * @licend The above is the entire license notice * for the JavaScript code in this file. */ window.rcmail && rcmail.addEventListener('init', function(evt) { if (rcmail.env.password_disabled) { $('#password-form input').prop('disabled', true); // reload page after ca. 3 minutes rcmail.reload(3 * 60 * 1000 - 2000); return; } rcmail.register_command('plugin.newpass-changed', function() { var input_newpasswd = rcube_find_object('_newpasswd'); var pass_strength = rcube_find_object('_pass_strength'); var score = 0; if (input_newpasswd.value.length) { // award every unique letter until 5 repetitions var letters = new Object(); for (var i=0; i= 1 && score <= 120) pass_strength.style.width = ' ' + score + 'px'; else if (score < 0) pass_strength.style.width = ' 1px'; if (score < 50) pass_strength.style.backgroundColor = 'red'; else if (score < 60) pass_strength.style.backgroundColor = 'orange'; else pass_strength.style.backgroundColor = 'green'; } else { pass_strength.style.width = ' 1px'; pass_strength.style.backgroundColor = 'red'; } }, true); // register command handler rcmail.register_command('plugin.password-save', function() { var input_curpasswd = rcube_find_object('_curpasswd'), input_newpasswd = rcube_find_object('_newpasswd'), input_confpasswd = rcube_find_object('_confpasswd'); var score = 0; if (input_newpasswd.value.length) { // award every unique letter until 5 repetitions var letters = new Object(); for (var i=0; i