sysauth.js 756 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. 'require ui';
  3. 'require view';
  4. return view.extend({
  5. render: function() {
  6. var form = document.querySelector('form'),
  7. btn = document.querySelector('button');
  8. var dlg = ui.showModal(
  9. _('Authorization Required'),
  10. [].slice.call(document.querySelectorAll('section > *')),
  11. 'login'
  12. );
  13. form.addEventListener('keypress', function(ev) {
  14. if (ev.key == 'Enter')
  15. btn.click();
  16. });
  17. btn.addEventListener('click', function() {
  18. dlg.querySelectorAll('*').forEach(function(node) { node.style.display = 'none' });
  19. dlg.appendChild(E('div', { 'class': 'spinning' }, _('Logging in…')));
  20. form.submit()
  21. });
  22. document.querySelector('input[type="password"]').focus();
  23. return '';
  24. },
  25. addFooter: function() {}
  26. });