commit | author | age
|
48e9c1
|
1 |
/* |
T |
2 |
* Password plugin script |
|
3 |
* @version @package_version@ |
|
4 |
*/ |
|
5 |
|
|
6 |
if (window.rcmail) { |
|
7 |
rcmail.addEventListener('init', function(evt) { |
|
8 |
// <span id="settingstabdefault" class="tablink"><roundcube:button command="preferences" type="link" label="preferences" title="editpreferences" /></span> |
|
9 |
var tab = $('<span>').attr('id', 'settingstabpluginpassword').addClass('tablink password'); |
|
10 |
var button = $('<a>').attr('href', rcmail.env.comm_path+'&_action=plugin.password') |
|
11 |
.html(rcmail.gettext('password')).appendTo(tab); |
|
12 |
|
|
13 |
// add button and register commands |
|
14 |
rcmail.add_element(tab, 'tabs'); |
|
15 |
rcmail.register_command('plugin.password-save', function() { |
|
16 |
var input_curpasswd = rcube_find_object('_curpasswd'); |
|
17 |
var input_newpasswd = rcube_find_object('_newpasswd'); |
|
18 |
var input_confpasswd = rcube_find_object('_confpasswd'); |
|
19 |
|
|
20 |
if (input_curpasswd && input_curpasswd.value=='') { |
|
21 |
alert(rcmail.gettext('nocurpassword', 'password')); |
|
22 |
input_curpasswd.focus(); |
|
23 |
} else if (input_newpasswd && input_newpasswd.value=='') { |
|
24 |
alert(rcmail.gettext('nopassword', 'password')); |
|
25 |
input_newpasswd.focus(); |
|
26 |
} else if (input_confpasswd && input_confpasswd.value=='') { |
|
27 |
alert(rcmail.gettext('nopassword', 'password')); |
|
28 |
input_confpasswd.focus(); |
|
29 |
} else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) { |
|
30 |
alert(rcmail.gettext('passwordinconsistency', 'password')); |
|
31 |
input_newpasswd.focus(); |
|
32 |
} else { |
|
33 |
rcmail.gui_objects.passform.submit(); |
|
34 |
} |
|
35 |
}, true); |
|
36 |
}) |
|
37 |
} |