You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AskForPassword.js 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. /* global APP, $ */
  2. import UIUtil from '../util/UIUtil';
  3. /**
  4. * Show dialog which asks for required conference password.
  5. * @returns {Promise<string>} password or nothing if user canceled
  6. */
  7. export default function askForPassword () {
  8. let titleKey = "dialog.passwordRequired";
  9. let passMsg = APP.translation.translateString("dialog.password");
  10. let msgString = `
  11. <input name="lockKey" type="text"
  12. data-i18n="[placeholder]dialog.password"
  13. placeholder="${passMsg}" autofocus>
  14. `;
  15. return new Promise(function (resolve, reject) {
  16. APP.UI.messageHandler.openTwoButtonDialog({
  17. titleKey,
  18. msgString,
  19. leftButtonKey: "dialog.Ok",
  20. submitFunction: $.noop,
  21. closeFunction: function (e, v, m, f) {
  22. if (v && f.lockKey) {
  23. resolve(UIUtil.escapeHtml(f.lockKey));
  24. } else {
  25. reject(APP.UI.messageHandler.CANCEL);
  26. }
  27. },
  28. focus: ':input:first'
  29. });
  30. });
  31. }