shibboleth_email_form.class.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Shibboleth;
  3. /**
  4. * Enter email form. When the email is mandatory and the Shibboleth email user field
  5. * is empty the system display this form and ask the user to provide an email.
  6. *
  7. * @todo: add email validation
  8. *
  9. * @license see /license.txt
  10. * @author Laurent Opprecht <laurent@opprecht.info>, Nicolas Rod for the University of Geneva
  11. */
  12. class ShibbolethEmailForm
  13. {
  14. /**
  15. *
  16. * @return ShibbolethEmailForm
  17. */
  18. public static function instance()
  19. {
  20. static $result = false;
  21. if (empty($result))
  22. {
  23. $result = new self();
  24. }
  25. return $result;
  26. }
  27. function display()
  28. {
  29. $email = get_lang('Email');
  30. $submit = get_lang('Submit');
  31. return <<<EOT
  32. <form id="email_form" action="" method="post">
  33. <label for="">$email</label>
  34. <input type="text" value="" tabindex="1" name="email" id="email_email" class=""><br/>
  35. <input type="submit" value="$submit" tabindex="2" name="submit" id="email_submit" class="submit">
  36. </form>
  37. EOT;
  38. }
  39. function get_email()
  40. {
  41. return isset($_POST['email']) ? $_POST['email'] : '';
  42. }
  43. }