renewPassword.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. *
  3. * @copyright Copyright (c) 2016, Roger Szabo (roger.szabo@web.de)
  4. *
  5. * @license AGPL-3.0-or-later
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as
  9. * published by the Free Software Foundation, either version 3 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. OCA = OCA || {};
  22. OCA.LDAP = _.extend(OC.LDAP || {}, {
  23. onRenewPassword: function () {
  24. $('#submit')
  25. .removeClass('icon-confirm-white')
  26. .addClass('icon-loading-small')
  27. .attr('value', t('core', 'Renewing …'));
  28. return true;
  29. },
  30. });
  31. window.addEventListener('DOMContentLoaded', function() {
  32. $('form[name=renewpassword]').submit(OCA.LDAP.onRenewPassword);
  33. if($('#newPassword').length) {
  34. $('#newPassword').showPassword().keyup();
  35. }
  36. $('#newPassword').strengthify({
  37. zxcvbn: OC.linkTo('core','vendor/zxcvbn/dist/zxcvbn.js'),
  38. titles: [
  39. t('core', 'Very weak password'),
  40. t('core', 'Weak password'),
  41. t('core', 'So-so password'),
  42. t('core', 'Good password'),
  43. t('core', 'Strong password')
  44. ],
  45. drawTitles: true,
  46. $addAfter: $('input[name="newPassword-clone"]'),
  47. });
  48. });