login.snippet.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Login
  4. *
  5. * Copyright 2010 by Jason Coward <jason@modx.com> and Shaun McCormick
  6. * <shaun@modx.com>
  7. *
  8. * Login is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the Free
  10. * Software Foundation; either version 2 of the License, or (at your option) any
  11. * later version.
  12. *
  13. * Login is distributed in the hope that it will be useful, but WITHOUT ANY
  14. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  15. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * Login; if not, write to the Free Software Foundation, Inc., 59 Temple
  19. * Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. * @package login
  22. */
  23. /**
  24. * MODx Login Snippet
  25. *
  26. * This snippet handles login POSTs, sending the user back to where they came from or to a specific
  27. * location if specified in the POST.
  28. *
  29. * @package login
  30. *
  31. * @property textfield actionKey The REQUEST variable containing the action to take.
  32. * @property textfield loginKey The actionKey for login.
  33. * @property textfield logoutKey The actionKey for logout.
  34. * @property boolean loginViaEmail Enable login via username or email address (either one!) [default: false]
  35. * @property list tplType The type of template to expect for the views:
  36. * modChunk - name of chunk to use
  37. * file - full path to file to use as tpl
  38. * embedded - the tpl is embedded in the page content
  39. * inline - the tpl is inline content provided directly
  40. * @property textfield loginTpl The template for the login view (content based on tplType)
  41. * @property textfield logoutTpl The template for the logout view (content based on tplType)
  42. * @property textfield errTpl The template for any errors that occur when processing an view
  43. * @property list errTplType The type of template to expect for the error messages:
  44. * modChunk - name of chunk to use
  45. * file - full path to file to use as tpl
  46. * inline - the tpl is inline content provided directly
  47. * @property integer logoutResourceId An explicit resource id to redirect users to on logout
  48. * @property string loginMsg The string to use for the login action. Defaults to
  49. * the lexicon string "login".
  50. * @property string logoutMsg The string to use for the logout action. Defaults
  51. * to the lexicon string "login.logout"
  52. */
  53. require_once $modx->getOption('login.core_path',null,$modx->getOption('core_path').'components/login/').'model/login/login.class.php';
  54. $login = new Login($modx,$scriptProperties);
  55. if (!is_object($login) || !($login instanceof Login)) return '';
  56. $controller = $login->loadController('Login');
  57. $output = $controller->run($scriptProperties);
  58. return $output;