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.

publicshareauth.js 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. passwordRequestButton.addEventListener('click', showEmailAddressPromptForm);
  45. });