Source for file login.act.php

Documentation is available at login.act.php

  1. <?php
  2. /**
  3. * @since 7/21/05
  4. * @package polyphony.authentication
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: login.act.php,v 1.16 2007/09/19 14:04:53 adamfranco Exp $
  10. */
  11.  
  12. require_once(POLYPHONY."/main/library/AbstractActions/Action.class.php");
  13.  
  14. /**
  15. * Change the language to the one specified by the user
  16. *
  17. * @since 7/21/05
  18. * @package polyphony.language
  19. *
  20. * @copyright Copyright &copy; 2005, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: login.act.php,v 1.16 2007/09/19 14:04:53 adamfranco Exp $
  24. */
  25. class loginAction
  26. extends Action
  27. {
  28. /**
  29. * Check Authorizations
  30. *
  31. * @return boolean
  32. * @access public
  33. * @since 4/26/05
  34. */
  35. function isAuthorizedToExecute () {
  36. return TRUE;
  37. }
  38. /**
  39. * Execute this action.
  40. *
  41. * @param object Harmoni $harmoni
  42. * @return mixed
  43. * @access public
  44. * @since 4/25/05
  45. */
  46. function execute ( $harmoni ) {
  47. $harmoni = Harmoni::instance();
  48. // If we are using only cookies, but cookies aren't enabled
  49. // (and hence not set), print an error message.
  50. if ($harmoni->config->get("sessionUseOnlyCookies")
  51. && !isset($_COOKIE[$harmoni->config->get("sessionName")]))
  52. {
  53. RequestContext::sendTo($harmoni->request->quickURL('auth', 'cookies_required'));
  54. }
  55.  
  56. $isAuthenticated = FALSE;
  57. $authN = Services::getService("AuthN");
  58. // authenticate.
  59. $authTypes =$authN->getAuthenticationTypes();
  60. while ($authTypes->hasNext()) {
  61. $authType =$authTypes->next();
  62. // Try authenticating with this type
  63. $authN->authenticateUser($authType);
  64. // If they are authenticated, quit
  65. if ($authN->isUserAuthenticated($authType)) {
  66. $isAuthenticated = TRUE;
  67. }
  68. }
  69.  
  70. if ($isAuthenticated) {
  71. // Send us back to where we want to be if we succeeded
  72. // (usually where we were)
  73. $harmoni->history->goBack("polyphony/display_login");
  74. } else {
  75. // send us to where we want to be if we failed
  76. // (possibly some form of authentication viewer)
  77. $harmoni->history->goBack("polyphony/login_fail");
  78. }
  79. $null = null;
  80. return $null;
  81. }
  82. }

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