publicshareauth.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. function showEmailAddressPromptForm() {
  2. // Shows email prompt
  3. var emailInput = document.getElementById('email-input-form');
  4. emailInput.style.display="block";
  5. // Shows back button
  6. var backButton = document.getElementById('request-password-back-button');
  7. backButton.style.display="block";
  8. // Hides password prompt and 'request password' button
  9. var passwordRequestButton = document.getElementById('request-password-button-not-talk');
  10. var passwordInput = document.getElementById('password-input-form');
  11. passwordRequestButton.style.display="none";
  12. passwordInput.style.display="none";
  13. // Hides identification result messages, if any
  14. var identificationResultSuccess = document.getElementById('identification-success');
  15. var identificationResultFailure = document.getElementById('identification-failure');
  16. if (identificationResultSuccess) {
  17. identificationResultSuccess.style.display="none";
  18. }
  19. if (identificationResultFailure) {
  20. identificationResultFailure.style.display="none";
  21. }
  22. }
  23. document.addEventListener('DOMContentLoaded', function() {
  24. // Enables password submit button only when user has typed something in the password field
  25. var passwordInput = document.getElementById('password');
  26. var passwordButton = document.getElementById('password-submit');
  27. var eventListener = function() {
  28. passwordButton.disabled = passwordInput.value.length === 0;
  29. };
  30. passwordInput.addEventListener('click', eventListener);
  31. passwordInput.addEventListener('keyup', eventListener);
  32. passwordInput.addEventListener('change', eventListener);
  33. // Enables email request button only when user has typed something in the email field
  34. var emailInput = document.getElementById('email');
  35. var emailButton = document.getElementById('password-request');
  36. eventListener = function() {
  37. emailButton.disabled = emailInput.value.length === 0;
  38. };
  39. emailInput.addEventListener('click', eventListener);
  40. emailInput.addEventListener('keyup', eventListener);
  41. emailInput.addEventListener('change', eventListener);
  42. // Adds functionality to the request password button
  43. var passwordRequestButton = document.getElementById('request-password-button-not-talk');
  44. if (passwordRequestButton) {
  45. passwordRequestButton.addEventListener('click', showEmailAddressPromptForm);
  46. }
  47. });