diff options
author | Hugues Hiegel <root@paranoid> | 2015-03-11 16:55:04 +0100 |
---|---|---|
committer | Hugues Hiegel <root@paranoid> | 2015-03-11 16:55:04 +0100 |
commit | 99f904adcc37d93c90defcd8ce898598e25be212 (patch) | |
tree | 60a6c7b7b9cf012d6c0e8dcf5c7f4fe0a5b6fc49 /libgpl/password/password.js | |
parent | b2034fdfec040a67988e543a911208ef2491ce7a (diff) |
Diffstat (limited to 'libgpl/password/password.js')
-rw-r--r-- | libgpl/password/password.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libgpl/password/password.js b/libgpl/password/password.js new file mode 100644 index 0000000..6b17b64 --- /dev/null +++ b/libgpl/password/password.js @@ -0,0 +1,36 @@ +/** + * Password plugin script + * @version @package_version@ + */ + +if (window.rcmail) { + rcmail.addEventListener('init', function(evt) { + + // 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'); + input_pwstrength = rcube_find_object('_pwstrength'); + + if (input_curpasswd && input_curpasswd.value == '') { + rcmail.display_message(rcmail.gettext('nocurpassword', 'password'), 'error'); + input_curpasswd.focus(); + } else if (input_newpasswd && input_newpasswd.value == '') { + rcmail.display_message(rcmail.gettext('nopassword', 'password'), 'error'); + input_newpasswd.focus(); + } else if (input_confpasswd && input_confpasswd.value == '') { + rcmail.display_message(rcmail.gettext('nopassword', 'password'), 'error'); + input_confpasswd.focus(); + } else if (input_newpasswd && input_confpasswd && input_newpasswd.value != input_confpasswd.value) { + rcmail.display_message(rcmail.gettext('passwordinconsistency', 'password'), 'error'); + input_newpasswd.focus(); + } else if (input_pwstrength.value == 0) { + rcmail.display_message(rcmail.gettext('passwordweak', 'pwstrength'), 'error'); + input_newpasswd.focus(); + } else { + rcmail.gui_objects.passform.submit(); + } + }, true); + }) +} |