commit | author | age
|
538e64
|
1 |
/** |
48e9c1
|
2 |
* Password plugin script |
b34d67
|
3 |
* |
TB |
4 |
* @licstart The following is the entire license notice for the |
|
5 |
* JavaScript code in this file. |
|
6 |
* |
|
7 |
* Copyright (c) 2012-2014, The Roundcube Dev Team |
|
8 |
* |
|
9 |
* The JavaScript code in this page is free software: you can redistribute it |
|
10 |
* and/or modify it under the terms of the GNU General Public License |
|
11 |
* as published by the Free Software Foundation, either version 3 of |
|
12 |
* the License, or (at your option) any later version. |
|
13 |
* |
|
14 |
* @licend The above is the entire license notice |
|
15 |
* for the JavaScript code in this file. |
48e9c1
|
16 |
*/ |
T |
17 |
|
abe381
|
18 |
window.rcmail && rcmail.addEventListener('init', function(evt) { |
252cc4
|
19 |
if (rcmail.env.password_disabled) { |
AM |
20 |
$('#password-form input').prop('disabled', true); |
|
21 |
// reload page after ca. 3 minutes |
|
22 |
rcmail.reload(3 * 60 * 1000 - 2000); |
|
23 |
return; |
|
24 |
} |
|
25 |
|
cf46ae
|
26 |
// register command handler |
abe381
|
27 |
rcmail.register_command('plugin.password-save', function() { |
AM |
28 |
var input_curpasswd = rcube_find_object('_curpasswd'), |
|
29 |
input_newpasswd = rcube_find_object('_newpasswd'), |
|
30 |
input_confpasswd = rcube_find_object('_confpasswd'); |
538e64
|
31 |
|
AM |
32 |
if (input_curpasswd && input_curpasswd.value == '') { |
8f8bea
|
33 |
alert(rcmail.get_label('nocurpassword', 'password')); |
48e9c1
|
34 |
input_curpasswd.focus(); |
abe381
|
35 |
} |
AM |
36 |
else if (input_newpasswd && input_newpasswd.value == '') { |
8f8bea
|
37 |
alert(rcmail.get_label('nopassword', 'password')); |
48e9c1
|
38 |
input_newpasswd.focus(); |
abe381
|
39 |
} |
AM |
40 |
else if (input_confpasswd && input_confpasswd.value == '') { |
8f8bea
|
41 |
alert(rcmail.get_label('nopassword', 'password')); |
48e9c1
|
42 |
input_confpasswd.focus(); |
abe381
|
43 |
} |
AM |
44 |
else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) { |
8f8bea
|
45 |
alert(rcmail.get_label('passwordinconsistency', 'password')); |
48e9c1
|
46 |
input_newpasswd.focus(); |
abe381
|
47 |
} |
AM |
48 |
else { |
48e9c1
|
49 |
rcmail.gui_objects.passform.submit(); |
T |
50 |
} |
|
51 |
}, true); |
abe381
|
52 |
|
AM |
53 |
$('input:not(:hidden):first').focus(); |
|
54 |
}); |