Login.template.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // This is just the basic "login" form.
  13. function template_login()
  14. {
  15. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  16. echo '
  17. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  18. <form action="', $scripturl, '?action=login2" name="frmLogin" id="frmLogin" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
  19. <div class="tborder login">
  20. <div class="cat_bar">
  21. <h3 class="catbg">
  22. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/login_sm.gif" alt="" class="icon" /> ', $txt['login'], '</span>
  23. </h3>
  24. </div>
  25. <span class="upperframe"><span></span></span>
  26. <div class="roundframe"><br class="clear" />';
  27. // Did they make a mistake last time?
  28. if (!empty($context['login_errors']))
  29. foreach ($context['login_errors'] as $error)
  30. echo '
  31. <p class="error">', $error, '</p>';
  32. // Or perhaps there's some special description for this time?
  33. if (isset($context['description']))
  34. echo '
  35. <p class="description">', $context['description'], '</p>';
  36. // Now just get the basic information - username, password, etc.
  37. echo '
  38. <dl>
  39. <dt>', $txt['username'], ':</dt>
  40. <dd><input type="text" name="user" size="20" value="', $context['default_username'], '" class="input_text" /></dd>
  41. <dt>', $txt['password'], ':</dt>
  42. <dd><input type="password" name="passwrd" value="', $context['default_password'], '" size="20" class="input_password" /></dd>
  43. </dl>';
  44. if (!empty($modSettings['enableOpenID']))
  45. echo '<p><strong>&mdash;', $txt['or'], '&mdash;</strong></p>
  46. <dl>
  47. <dt>', $txt['openid'], ':</dt>
  48. <dd><input type="text" name="openid_identifier" class="input_text openid_login" size="17" />&nbsp;<em><a href="', $scripturl, '?action=helpadmin;help=register_openid" onclick="return reqWin(this.href);" class="help">(?)</a></em></dd>
  49. </dl><hr />';
  50. echo '
  51. <dl>
  52. <dt>', $txt['mins_logged_in'], ':</dt>
  53. <dd><input type="text" name="cookielength" size="4" maxlength="4" value="', $modSettings['cookieTime'], '"', $context['never_expire'] ? ' disabled="disabled"' : '', ' class="input_text" /></dd>
  54. <dt>', $txt['always_logged_in'], ':</dt>
  55. <dd><input type="checkbox" name="cookieneverexp"', $context['never_expire'] ? ' checked="checked"' : '', ' class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>';
  56. // If they have deleted their account, give them a chance to change their mind.
  57. if (isset($context['login_show_undelete']))
  58. echo '
  59. <dt class="alert">', $txt['undelete_account'], ':</dt>
  60. <dd><input type="checkbox" name="undelete" class="input_check" /></dd>';
  61. echo '
  62. </dl>
  63. <p><input type="submit" value="', $txt['login'], '" class="button_submit" /></p>
  64. <p class="smalltext"><a href="', $scripturl, '?action=reminder">', $txt['forgot_your_password'], '</a></p>
  65. <input type="hidden" name="hash_passwrd" value="" />
  66. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  67. <input type="hidden" name="', $context['login_token_var'], '" value="', $context['login_token'], '" />
  68. </div>
  69. <span class="lowerframe"><span></span></span>
  70. </div></form>';
  71. // Focus on the correct input - username or password.
  72. echo '
  73. <script type="text/javascript"><!-- // --><![CDATA[
  74. document.forms.frmLogin.', isset($context['default_username']) && $context['default_username'] != '' ? 'passwrd' : 'user', '.focus();
  75. // ]]></script>';
  76. }
  77. // Tell a guest to get lost or login!
  78. function template_kick_guest()
  79. {
  80. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  81. // This isn't that much... just like normal login but with a message at the top.
  82. echo '
  83. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  84. <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" name="frmLogin" id="frmLogin"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
  85. <div class="tborder login">
  86. <div class="cat_bar">
  87. <h3 class="catbg">', $txt['warning'], '</h3>
  88. </div>';
  89. // Show the message or default message.
  90. echo '
  91. <p class="information centertext">
  92. ', empty($context['kick_message']) ? $txt['only_members_can_access'] : $context['kick_message'], '<br />
  93. ', $txt['login_below'], ' <a href="', $scripturl, '?action=register">', $txt['register_an_account'], '</a> ', sprintf($txt['login_with_forum'], $context['forum_name_html_safe']), '
  94. </p>';
  95. // And now the login information.
  96. echo '
  97. <div class="cat_bar">
  98. <h3 class="catbg">
  99. <img src="', $settings['images_url'], '/icons/login_sm.gif" alt="" class="icon" /> ', $txt['login'], '
  100. </h3>
  101. </div>
  102. <span class="upperframe"><span></span></span>
  103. <div class="roundframe">
  104. <dl>
  105. <dt>', $txt['username'], ':</dt>
  106. <dd><input type="text" name="user" size="20" class="input_text" /></dd>
  107. <dt>', $txt['password'], ':</dt>
  108. <dd><input type="password" name="passwrd" size="20" class="input_password" /></dd>';
  109. if (!empty($modSettings['enableOpenID']))
  110. echo '
  111. </dl>
  112. <p><strong>&mdash;', $txt['or'], '&mdash;</strong></p>
  113. <dl>
  114. <dt>', $txt['openid'], ':</dt>
  115. <dd><input type="text" name="openid_identifier" class="input_text openid_login" size="17" /></dd>
  116. </dl>
  117. <hr />
  118. <dl>';
  119. echo '
  120. <dt>', $txt['mins_logged_in'], ':</dt>
  121. <dd><input type="text" name="cookielength" size="4" maxlength="4" value="', $modSettings['cookieTime'], '" class="input_text" /></dd>
  122. <dt>', $txt['always_logged_in'], ':</dt>
  123. <dd><input type="checkbox" name="cookieneverexp" class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>
  124. </dl>
  125. <p class="centertext"><input type="submit" value="', $txt['login'], '" class="button_submit" /></p>
  126. <p class="centertext smalltext"><a href="', $scripturl, '?action=reminder">', $txt['forgot_your_password'], '</a></p>
  127. </div>
  128. <span class="lowerframe"><span></span></span>
  129. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  130. <input type="hidden" name="', $context['login_token_var'], '" value="', $context['login_token'], '" />
  131. <input type="hidden" name="hash_passwrd" value="" />
  132. </div>
  133. </form>';
  134. // Do the focus thing...
  135. echo '
  136. <script type="text/javascript"><!-- // --><![CDATA[
  137. document.forms.frmLogin.user.focus();
  138. // ]]></script>';
  139. }
  140. // This is for maintenance mode.
  141. function template_maintenance()
  142. {
  143. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  144. // Display the administrator's message at the top.
  145. echo '
  146. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  147. <form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
  148. <div class="tborder login" id="maintenance_mode">
  149. <div class="cat_bar">
  150. <h3 class="catbg">', $context['title'], '</h3>
  151. </div>
  152. <p class="description">
  153. <img class="floatleft" src="', $settings['images_url'], '/construction.png" width="40" height="40" alt="', $txt['in_maintain_mode'], '" />
  154. ', $context['description'], '<br class="clear" />
  155. </p>
  156. <div class="title_bar">
  157. <h4 class="titlebg">', $txt['admin_login'], '</h4>
  158. </div>
  159. <span class="upperframe"><span></span></span>
  160. <div class="roundframe">
  161. <dl>
  162. <dt>', $txt['username'], ':</dt>
  163. <dd><input type="text" name="user" size="20" class="input_text" /></dd>
  164. <dt>', $txt['password'], ':</dt>
  165. <dd><input type="password" name="passwrd" size="20" class="input_password" /></dd>
  166. <dt>', $txt['mins_logged_in'], ':</dt>
  167. <dd><input type="text" name="cookielength" size="4" maxlength="4" value="', $modSettings['cookieTime'], '" class="input_text" /></dd>
  168. <dt>', $txt['always_logged_in'], ':</dt>
  169. <dd><input type="checkbox" name="cookieneverexp" class="input_check" /></dd>
  170. </dl>
  171. <p class="centertext"><input type="submit" value="', $txt['login'], '" class="button_submit" /></p>
  172. </div>
  173. <span class="lowerframe"><span></span></span>
  174. <input type="hidden" name="hash_passwrd" value="" />
  175. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  176. <input type="hidden" name="', $context['login_token_var'], '" value="', $context['login_token'], '" />
  177. </div>
  178. </form>';
  179. }
  180. // This is for the security stuff - makes administrators login every so often.
  181. function template_admin_login()
  182. {
  183. global $context, $settings, $options, $scripturl, $txt;
  184. // Since this should redirect to whatever they were doing, send all the get data.
  185. echo '
  186. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  187. <form action="', $scripturl, $context['get_data'], '" method="post" accept-charset="', $context['character_set'], '" name="frmLogin" id="frmLogin" onsubmit="hash', ucfirst($context['sessionCheckType']), 'Password(this, \'', $context['user']['username'], '\', \'', $context['session_id'], '\');">
  188. <div class="tborder login" id="admin_login">
  189. <div class="cat_bar">
  190. <h3 class="catbg">
  191. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/login_sm.gif" alt="" class="icon" /> ', $txt['login'], '</span>
  192. </h3>
  193. </div>
  194. <span class="upperframe"><span></span></span>
  195. <div class="roundframe centertext">';
  196. if (!empty($context['incorrect_password']))
  197. echo '
  198. <div class="error">', $txt['admin_incorrect_password'], '</div>';
  199. echo '
  200. <strong>', $txt['password'], ':</strong>
  201. <input type="password" name="', $context['sessionCheckType'], '_pass" size="24" class="input_password" />
  202. <a href="', $scripturl, '?action=helpadmin;help=securityDisable_why" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" alt="', $txt['help'], '" /></a><br />
  203. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  204. <input type="hidden" name="', $context['admin-login_token_var'], '" value="', $context['admin-login_token'], '" />
  205. <input type="submit" style="margin-top: 1em;" value="', $txt['login'], '" class="button_submit" />';
  206. // Make sure to output all the old post data.
  207. echo $context['post_data'], '
  208. </div>
  209. <span class="lowerframe"><span></span></span>
  210. </div>
  211. <input type="hidden" name="', $context['sessionCheckType'], '_hash_pass" value="" />
  212. </form>';
  213. // Focus on the password box.
  214. echo '
  215. <script type="text/javascript"><!-- // --><![CDATA[
  216. document.forms.frmLogin.admin_pass.focus();
  217. // ]]></script>';
  218. }
  219. // Activate your account manually?
  220. function template_retry_activate()
  221. {
  222. global $context, $settings, $options, $txt, $scripturl;
  223. // Just ask them for their code so they can try it again...
  224. echo '
  225. <form action="', $scripturl, '?action=activate;u=', $context['member_id'], '" method="post" accept-charset="', $context['character_set'], '">
  226. <div class="title_bar">
  227. <h3 class="titlebg">', $context['page_title'], '</h3>
  228. </div>
  229. <span class="upperframe"><span></span></span>
  230. <div class="roundframe">';
  231. // You didn't even have an ID?
  232. if (empty($context['member_id']))
  233. echo '
  234. <dl>
  235. <dt>', $txt['invalid_activation_username'], ':</dt>
  236. <dd><input type="text" name="user" size="30" class="input_text" /></dd>';
  237. echo '
  238. <dt>', $txt['invalid_activation_retry'], ':</dt>
  239. <dd><input type="text" name="code" size="30" class="input_text" /></dd>
  240. </dl>
  241. <p><input type="submit" value="', $txt['invalid_activation_submit'], '" class="button_submit" /></p>
  242. </div>
  243. <span class="lowerframe"><span></span></span>
  244. </form>';
  245. }
  246. // Activate your account manually?
  247. function template_resend()
  248. {
  249. global $context, $settings, $options, $txt, $scripturl;
  250. // Just ask them for their code so they can try it again...
  251. echo '
  252. <form action="', $scripturl, '?action=activate;sa=resend" method="post" accept-charset="', $context['character_set'], '">
  253. <div class="title_bar">
  254. <h3 class="titlebg">', $context['page_title'], '</h3>
  255. </div>
  256. <span class="upperframe"><span></span></span>
  257. <div class="roundframe">
  258. <dl>
  259. <dt>', $txt['invalid_activation_username'], ':</dt>
  260. <dd><input type="text" name="user" size="40" value="', $context['default_username'], '" class="input_text" /></dd>
  261. </dl>
  262. <p>', $txt['invalid_activation_new'], '</p>
  263. <dl>
  264. <dt>', $txt['invalid_activation_new_email'], ':</dt>
  265. <dd><input type="text" name="new_email" size="40" class="input_text" /></dd>
  266. <dt>', $txt['invalid_activation_password'], ':</dt>
  267. <dd><input type="password" name="passwd" size="30" class="input_password" /></dd>
  268. </dl>';
  269. if ($context['can_activate'])
  270. echo '
  271. <p>', $txt['invalid_activation_known'], '</p>
  272. <dl>
  273. <dt>', $txt['invalid_activation_retry'], ':</dt>
  274. <dd><input type="text" name="code" size="30" class="input_text" /></dd>
  275. </dl>';
  276. echo '
  277. <p><input type="submit" value="', $txt['invalid_activation_resend'], '" class="button_submit" /></p>
  278. </div>
  279. <span class="lowerframe"><span></span></span>
  280. </form>';
  281. }
  282. ?>