|
@@ -11,6 +11,40 @@ class accountController extends Staple_AuthController
|
|
|
|
|
|
public function index()
|
|
|
{
|
|
|
+ $form = new adminAccountForm();
|
|
|
+ if($form->wasSubmitted())
|
|
|
+ {
|
|
|
+ $form->addData($_POST);
|
|
|
+ if($form->validate())
|
|
|
+ {
|
|
|
+ $password = $_POST['password'];
|
|
|
+ $account = $_POST['username'];
|
|
|
+
|
|
|
+ $auth = Staple_Auth::get();
|
|
|
+
|
|
|
+ $granted = $auth->doAuth(array('username'=>$account,'password'=>$password));
|
|
|
+
|
|
|
+ if($granted === true)
|
|
|
+ {
|
|
|
+ header('Location: '.$this->_link(array('timesheet','index')));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $this->view->message = "Invalid login";
|
|
|
+ $this->view->form = $form;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $this->view->form = $form;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $this->view->form = $form;
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
$form = new accountForm();
|
|
|
if($form->wasSubmitted())
|
|
|
{
|
|
@@ -47,6 +81,7 @@ class accountController extends Staple_AuthController
|
|
|
{
|
|
|
$this->view->form = $form;
|
|
|
}
|
|
|
+ */
|
|
|
}
|
|
|
|
|
|
public function account()
|