Source for file BasicFormNamePassTokenCollector.class.php

Documentation is available at BasicFormNamePassTokenCollector.class.php

  1. <?php
  2. /**
  3. * @package harmoni.osid_v2.authentication
  4. *
  5. * @copyright Copyright &copy; 2005, Middlebury College
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  7. *
  8. * @version $Id: BasicFormNamePassTokenCollector.class.php,v 1.4 2007/09/04 20:25:37 adamfranco Exp $
  9. */
  10.  
  11. require_once(dirname(__FILE__)."/NamePassTokenCollector.abstract.php");
  12.  
  13. /**
  14. * The HTTPAuthNamePassTokenCollector prompts a user for their name and password
  15. * by sending HTTP Authenticatio headers to the user.
  16. *
  17. * @package harmoni.osid_v2.authentication
  18. *
  19. * @copyright Copyright &copy; 2005, Middlebury College
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  21. *
  22. * @version $Id: BasicFormNamePassTokenCollector.class.php,v 1.4 2007/09/04 20:25:37 adamfranco Exp $
  23. */
  24. class BasicFormNamePassTokenCollector
  25. extends NamePassTokenCollector
  26. {
  27. /**
  28. * Prompt the user to supply their tokens
  29. *
  30. * @return void
  31. * @access public
  32. * @since 3/16/05
  33. */
  34. function prompt () {
  35. $harmoni = Harmoni::instance();
  36. $harmoni->request->startNamespace("harmoni-authentication");
  37. $action = $_SERVER['REQUEST_URI'];
  38. $usernameField = $harmoni->request->getName("username");
  39. $passwordField = $harmoni->request->getName("password");
  40. $usernameText = _("Username");
  41. $passwordText = _("Password");
  42. print<<<END
  43.  
  44. <form name='login' action='$action' method='post'>
  45. $usernameText: <input type='text' name='$usernameField' />
  46. <br />$passwordText: <input type='password' name='$passwordField' />
  47. <br /><input type='submit' />
  48. </form>
  49.  
  50. END;
  51. $harmoni->request->endNamespace();
  52. exit;
  53. }
  54. /**
  55. * Collect the name that the user may have supplied, Reply NULL if none
  56. * are found.
  57. *
  58. * @return mixed
  59. * @access public
  60. * @since 3/16/05
  61. */
  62. function collectName () {
  63. $harmoni = Harmoni::instance();
  64. $harmoni->request->startNamespace("harmoni-authentication");
  65. $username = $harmoni->request->get("username");
  66. $harmoni->request->endNamespace();
  67. return $username;
  68. }
  69. /**
  70. * Collect the password that the user may have supplied, Reply NULL if none
  71. * are found.
  72. *
  73. * @return mixed
  74. * @access public
  75. * @since 3/16/05
  76. */
  77. function collectPassword () {
  78. $harmoni = Harmoni::instance();
  79. $harmoni->request->startNamespace("harmoni-authentication");
  80. $password = $harmoni->request->get("password");
  81. $harmoni->request->endNamespace();
  82. return $password;
  83. }
  84. }
  85.  
  86. ?>

Documentation generated on Wed, 19 Sep 2007 10:21:44 -0400 by phpDocumentor 1.3.0RC3