index-unlogged-dist.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Redirect script.
  5. *
  6. * @package chamilo.custompages
  7. */
  8. require_once api_get_path(SYS_PATH).'main/inc/global.inc.php';
  9. require_once __DIR__.'/language.php';
  10. /**
  11. * Homemade micro-controller.
  12. */
  13. if (isset($_GET['loginFailed'])) {
  14. if (isset($_GET['error'])) {
  15. switch ($_GET['error']) {
  16. case 'account_expired':
  17. $error_message = custompages_get_lang('Account expired');
  18. break;
  19. case 'account_inactive':
  20. $error_message = custompages_get_lang('Account inactive');
  21. break;
  22. case 'user_password_incorrect':
  23. $error_message = custompages_get_lang('Login failed - incorrect login or password.');
  24. break;
  25. case 'access_url_inactive':
  26. $error_message = custompages_get_lang('Account inactive for this URL');
  27. break;
  28. default:
  29. $error_message = custompages_get_lang('Login failed - incorrect login or password.');
  30. }
  31. } else {
  32. $error_message = get_lang('Login failed - incorrect login or password.');
  33. }
  34. }
  35. $rootWeb = api_get_path('WEB_PATH');
  36. /**
  37. * HTML output.
  38. */
  39. ?>
  40. <html>
  41. <head>
  42. <title>Custompage - login</title>
  43. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  44. <script type="text/javascript" src="<?php echo $rootWeb; ?>web/assets/jquery/dist/jquery.min.js"></script>
  45. <script type="text/javascript">
  46. $(document).ready(function() {
  47. if (top.location != location) {
  48. top.location.href = document.location.href;
  49. }
  50. // Handler pour la touche retour
  51. $('input').keyup(function(e) {
  52. if (e.keyCode == 13) {
  53. $('#login-form').submit();
  54. }
  55. });
  56. });
  57. </script>
  58. </head>
  59. <body>
  60. <div id="backgroundimage">
  61. <img src="<?php echo api_get_path(WEB_PATH); ?>/custompages/images/page-background.png" class="backgroundimage" />
  62. </div>
  63. <div id="wrapper">
  64. <div id="header">
  65. <img src="<?php echo api_get_path(WEB_PATH); ?>/custompages/images/header.png" alt="Logo" />
  66. </div> <!-- #header -->
  67. <div id="login-form-box" class="form-box">
  68. <div id="login-form-info" class="form-info">
  69. <?php if (isset($content['info']) && !empty($content['info'])) {
  70. echo $content['info'];
  71. }
  72. ?>
  73. </div>
  74. <?php if (isset($error_message)) {
  75. echo '<div id="login-form-info" class="form-error">'.$error_message.'</div>';
  76. }
  77. ?>
  78. <form id="login-form" class="form" action="<?php echo api_get_path(WEB_PATH); ?>index.php" method="post">
  79. <div>
  80. <label for="login">*<?php echo custompages_get_lang('User'); ?></label>
  81. <input name="login" type="text" /><br />
  82. <label for="password">*<?php echo custompages_get_lang('Password'); ?></label>
  83. <input name="password" type="password" /><br />
  84. </div>
  85. </form>
  86. <div id="login-form-submit" class="form-submit" onclick="document.forms['login-form'].submit();">
  87. <span><?php echo custompages_get_lang('Login'); ?></span>
  88. </div> <!-- #form-submit -->
  89. <div id="links">
  90. <?php if (api_get_setting('allow_registration') === 'true') {
  91. ?>
  92. <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/inscription.php?language=<?php echo api_get_interface_language(); ?>">
  93. <?php echo custompages_get_lang('Registration'); ?>
  94. </a><br />
  95. <?php
  96. } ?>
  97. <a href="<?php echo api_get_path(WEB_CODE_PATH); ?>auth/lostPassword.php?language=<?php echo api_get_interface_language(); ?>">
  98. <?php echo custompages_get_lang('I lost my password'); ?>
  99. </a>
  100. </div>
  101. </div> <!-- #form -->
  102. <div id="footer">
  103. <img src="<?php echo api_get_path(WEB_PATH); ?>/custompages/images/footer.png" />
  104. </div> <!-- #footer -->
  105. </div> <!-- #wrapper -->
  106. </body>
  107. </html>