Mercurial > hg > rc1
comparison plugins/password/password.js @ 0:1e000243b222
vanilla 1.3.3 distro, I hope
author | Charlie Root |
---|---|
date | Thu, 04 Jan 2018 15:50:29 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1e000243b222 |
---|---|
1 /** | |
2 * Password plugin script | |
3 * | |
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. | |
16 */ | |
17 | |
18 window.rcmail && rcmail.addEventListener('init', function(evt) { | |
19 if (rcmail.env.password_disabled) { | |
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 | |
26 // register command handler | |
27 rcmail.register_command('plugin.password-save', function() { | |
28 var input_curpasswd = rcube_find_object('_curpasswd'), | |
29 input_newpasswd = rcube_find_object('_newpasswd'), | |
30 input_confpasswd = rcube_find_object('_confpasswd'); | |
31 | |
32 if (input_curpasswd && input_curpasswd.value == '') { | |
33 alert(rcmail.get_label('nocurpassword', 'password')); | |
34 input_curpasswd.focus(); | |
35 } | |
36 else if (input_newpasswd && input_newpasswd.value == '') { | |
37 alert(rcmail.get_label('nopassword', 'password')); | |
38 input_newpasswd.focus(); | |
39 } | |
40 else if (input_confpasswd && input_confpasswd.value == '') { | |
41 alert(rcmail.get_label('nopassword', 'password')); | |
42 input_confpasswd.focus(); | |
43 } | |
44 else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) { | |
45 alert(rcmail.get_label('passwordinconsistency', 'password')); | |
46 input_newpasswd.focus(); | |
47 } | |
48 else { | |
49 rcmail.gui_objects.passform.submit(); | |
50 } | |
51 }, true); | |
52 | |
53 $('input:not(:hidden):first').focus(); | |
54 }); |