/mvc/elements/account/login
[return to app]1
<?php
2 if (!isset($loginAction)) {
3 $loginAction = get::url(array('ssl' => true));
4 }
5 echo $form->open(array('action' => $loginAction, 'id' => 'loginform'));
6
7 $url = get::url(array('get' => true));
8 $url .= (strpos($url, '?') !== false ? '&' : '?') . 'signup=true';
9 echo $html->div($html->link($url, 'New user sign up'));
10
11 if (isset($_POST['errors']['login'])) {
12 echo $form->getErrorMessageContainer('email', $_POST['errors']['login']);
13 }
14 $args = array('name' => 'login_email', 'label' => 'Email', 'id' => 'loginemail', 'addBreak' => false);
15 echo $html->div($form->input($args));
16 $args = array('name' => 'login_pass', 'label' => 'Pass', 'id' => 'loginpass', 'addBreak' => false);
17 echo $html->div($form->password($args));
18
19 $forgotPassLink = $html->link('javascript: forgotpass();', 'Forgot your password?', array('id' =>
'forgotpassword'));
20 echo '<div id="forgotpass"></div>';
21 echo $html->jsInline($html->jsTools(true) . 'dom("forgotpass").innerHTML = "' . addslashes($forgotPassLink) . '";
22 function forgotpass() {
23 var loginform = dom("loginform");
24 var forgotPass = document.createElement("input");
25 forgotPass.setAttribute("type", "hidden");
26 forgotPass.setAttribute("name", "action");
27 forgotPass.setAttribute("value", "forgotPassword");
28 loginform.appendChild(forgotPass);
29 loginform.submit();
30 return false;
31 }');
32
33 echo $form->submit('Login');
34
35 echo $form->close();