23 require_once(
'ProfileTable.php');
24 require_once(
'Profile.php');
35 require_once(
'LoginForm.php');
37 'action' =>
'/login/process',
43 require_once(
'SignupForm.php');
45 'action' =>
'/login/processSignup',
51 echo
"Failed to connect to the database. Please make sure that Hypertable ".
52 "is up and running. See <a href=\"/about\">About</a> for ".
53 "installation instructions.<br />".
54 "<br />".$e->getMessage().
"<br />".
55 "<br /><pre>$e</pre>";
60 require_once(
'MyAuthAdapter.php');
61 return new MyAuthAdapter($params[
'username'], $params[
'password']);
67 if (Zend_Auth::getInstance()->hasIdentity()) {
68 if (
'logout' != $this->getRequest()->getActionName())
69 $this->_helper->redirector(
'index',
'index');
74 if (
'logout' == $this->getRequest()->getActionName())
75 $this->_helper->redirector(
'index');
85 $request = $this->getRequest();
88 if (!$request->isPost())
89 return $this->_helper->redirector(
'index');
93 if (!$form->isValid($request->getPost())) {
94 $this->view->loginForm = $form;
96 return $this->render(
'index');
101 $auth = Zend_Auth::getInstance();
103 $result = $auth->authenticate($adapter);
105 catch (Exception $e) {
108 if (!$result->isValid()) {
109 $form->setDescription(
'Invalid credentials provided');
110 $this->view->loginForm = $form;
112 return $this->render(
'index');
116 $this->_helper->redirector(
'index',
'index');
120 Zend_Auth::getInstance()->clearIdentity();
121 $this->_helper->redirector(
'index');
125 $request = $this->getRequest();
128 if (!$request->isPost())
129 return $this->_helper->redirector(
'index');
134 if (!$form->isValid($request->getPost())) {
136 $this->view->signupForm = $form;
137 return $this->render(
'index');
142 $ar=$form->getValues();
143 $username=$ar[
'username'];
147 catch (Exception $e) {
151 $form->setDescription(
'Username already exists, please choose '.
154 $this->view->signupForm = $form;
155 return $this->render(
'index');
158 $profile->setId($username);
159 $profile->setPasswordPlain(
'');
166 $auth=Zend_Auth::getInstance();
167 $result=$auth->authenticate($adapter);
168 if (!$result->isValid())
169 die(
"This should never happen...");
170 $this->_helper->redirector(
'index',
'profile');
Copyright (C) 2007-2015 Hypertable, Inc.
Copyright (C) 2007-2015 Hypertable, Inc.
handleError(Exception $e)
getAuthAdapter(array $params)