Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Started work on merging login and register pages into one

  • Loading branch information...
commit 4eecbaa41e213a16fb9f8d4ec0d6834659442533 1 parent 2dfc674
@PHLAK PHLAK authored
View
30 application/layouts/layout.phtml
@@ -27,14 +27,13 @@
<div id="siteTitle" class="floatLeft">
<?=$this->translate('issues');?>
</div>
- <div id="accountInfo" class="floatRight">
- <?php if(Zend_Registry::get('Default_DiContainer')->getAclService()->isAllowed('user', 'logout')): ?>
- Signed in as <?= Zend_Auth::getInstance()->getIdentity()->getUsername(); ?> | <a href="<?=$this->url(array('controller'=>'auth','action'=>'logout'), null, true);?>"><?= $this->translate('sign_out'); ?></a>
- <?php else: ?>
- <a href="<?=$this->url(array('controller'=>'auth','action'=>'login'), null, true);?>"><?= $this->translate('sign_in'); ?></a> |
- <a href="<?=$this->url(array('controller'=>'register','action'=>'index'), null, true);?>"><?=$this->translate('register');?></a>
- <?php endif; ?>
- </div>
+
+ <form method="post" action="#" id="siteSearchForm" class="floatRight">
+ <label id="siteSearch" for="siteSearchInput">
+ <input type="text" name="siteSearchInput" tabIndex="1" id="siteSearchInput" />
+ </label>
+ <button type="submit" id="siteSearchButton"><?=$this->translate('go');?></button>
+ </form>
</div>
<div class="clearfix">
@@ -69,14 +68,15 @@
<li <?php if(Zend_Controller_Front::getInstance()->getRequest()->getControllerName() == 'members'): ?>class="active"<?php endif; ?>>
<a href="#"><?=$this->translate('members');?></a>
</li>
+
+ <li class="floatRight">
+ <?php if(Zend_Registry::get('Default_DiContainer')->getAclService()->isAllowed('user', 'logout')): ?>
+ Signed in as <?= Zend_Auth::getInstance()->getIdentity()->getUsername(); ?> | <a href="<?=$this->url(array('controller'=>'auth','action'=>'logout'), null, true);?>"><?= $this->translate('sign_out'); ?></a>
+ <?php else: ?>
+ <a href="<?=$this->url(array('controller'=>'auth','action'=>'index'), null, true);?>"><?= $this->translate('sign_in'); ?> / <?=$this->translate('register');?></a>
+ <?php endif; ?>
+ </li>
</ul>
-
- <form method="post" action="#" id="siteSearchForm" class="floatRight">
- <label id="siteSearch" for="siteSearchInput">
- <input type="text" name="siteSearchInput" tabIndex="1" id="siteSearchInput" />
- </label>
- <button type="submit" id="siteSearchButton"><?=$this->translate('go');?></button>
- </form>
</div>
<?php $counts = Zend_Registry::get('Default_DiContainer')->getIssueService()->getIssueCounts(); ?>
<div class="tabListBottom">
View
55 application/modules/default/controllers/AuthController.php
@@ -6,15 +6,14 @@ public function init()
$this->_userService = Zend_Registry::get('Default_DiContainer')->getUserService();
$fm = $this->getHelper('FlashMessenger')->setNamespace('loginForm')->getMessages();
$this->view->loginForm = (count($fm) > 0) ? $fm[0] : $this->getLoginForm();
+ $this->view->registerForm = (count($fm) > 0) ? $fm[0] : $this->getRegisterForm();
$this->_aclService = Zend_Registry::get('Default_DiContainer')->getAclService();
}
-
- public function loginAction()
+
+ public function indexAction()
{
- if (!$this->_aclService->isAllowed('user', 'login')) {
- return $this->_helper->redirector('index', 'index');
- }
+ // Index...
}
public function logoutAction()
@@ -22,24 +21,58 @@ public function logoutAction()
$this->_userService->logout();
return $this->_helper->redirector('index','index');
}
+
+ public function getLoginForm()
+ {
+ return $this->_userService->getLoginForm()->setAction($this->_helper->url->direct('authenticate-post'));
+ }
- public function authenticateAction()
+ public function getRegisterForm()
{
+ return $this->_userService->getRegisterForm()->setAction($this->_helper->url->direct('register-post'));
+ }
+
+ public function authenticatePostAction()
+ {
+ // ACL Check for authentication action
+ if (!$this->_aclService->isAllowed('auth', 'login')) {
+ return $this->_helper->redirector('index', 'index');
+ }
+
$form = $this->view->loginForm;
$request = $this->getRequest();
- if (!$request->isPost()) return $this->_helper->redirector('login');
+ if (!$request->isPost()) return $this->_helper->redirector('index');
$form->populate($request->getPost());
$vals = $form->getValues();
if (false === $this->_userService->authenticate($vals['username'], $vals['password'])) {
$form->setDescription($this->view->translate('login_failed'));
$this->_helper->FlashMessenger->setNamespace('loginForm')->addMessage($form);
- $this->_helper->redirector('login');
+ $this->_helper->redirector('index');
}
return $this->_helper->redirector('index', 'index');
}
-
- public function getLoginForm()
+
+ public function registerPostAction()
{
- return $this->_userService->getLoginForm()->setAction($this->_helper->url->direct('authenticate'));
+ // ACL Check for registration action
+ if (!$this->_aclService->isAllowed('user', 'register')) {
+ return $this->_helper->redirector('index', 'index');
+ }
+
+ $form = $this->view->registerForm;
+ $request = $this->getRequest();
+ if (!$request->isPost()) return $this->_helper->redirector('index');
+ if (false === $form->isValid($request->getPost())) {
+ $form->setDescription($this->view->translate('registration_failed'));
+ $this->_helper->FlashMessenger->setNamespace('registerForm')->addMessage($form);
+ $this->_helper->redirector('index');
+ }
+ if (!$this->_userService->createFromForm($form)) {
+ $form->setDescription($this->view->translate('registration_failed'));
+ $this->_helper->FlashMessenger->setNamespace('registerForm')->addMessage($form);
+ return $this->_helper->redirector('index');
+ }
+ return $this->_helper->redirector('index', 'auth');
}
+
}
View
44 application/modules/default/controllers/RegisterController.php
@@ -1,44 +0,0 @@
-<?php
-class Default_RegisterController extends Zend_Controller_Action
-{
- public function init()
- {
- $this->_userService = Zend_Registry::get('Default_DiContainer')->getUserService();
- $fm = $this->getHelper('FlashMessenger')->setNamespace('registerForm')->getMessages();
- $this->view->registerForm = (count($fm) > 0) ? $fm[0] : $this->getRegisterForm();
-
- $this->_aclService = Zend_Registry::get('Default_DiContainer')->getAclService();
- }
-
- public function indexAction()
- {
- if (!$this->_aclService->isAllowed('user', 'register')) {
- return $this->_helper->redirector('index', 'index');
- }
- }
-
- public function postAction()
- {
- $form = $this->view->registerForm;
- $request = $this->getRequest();
- if (!$request->isPost()) return $this->_helper->redirector('index');
- if (false === $form->isValid($request->getPost())) {
- $form->setDescription($this->view->translate('registration_failed'));
- $this->_helper->FlashMessenger->setNamespace('registerForm')->addMessage($form);
- $this->_helper->redirector('index');
- }
- if (!$this->_userService->createFromForm($form)) {
- $form->setDescription($this->view->translate('registration_failed'));
- $this->_helper->FlashMessenger->setNamespace('registerForm')->addMessage($form);
- return $this->_helper->redirector('index');
- }
- return $this->_helper->redirector('login', 'auth');
- }
-
- public function getRegisterForm()
- {
- return $this->_userService->getRegisterForm()->setAction($this->_helper->url->direct('post'));
- }
-
-}
-
View
14 application/modules/default/views/scripts/auth/index.phtml
@@ -0,0 +1,14 @@
+<div class="floatLeft">
+ <div class="formWrapper">
+ <h2 class="formTitle"><?=$this->translate('sign_in');?></h2>
+ <?= $this->loginForm; ?>
+ </div>
+</div>
+
+<div class="floatRight">
+ <div class="formWrapper">
+ <h2 class="formTitle"><?=$this->translate('register');?></h2>
+ <?= $this->registerForm; ?>
+ </div>
+</div>
+
View
4 application/modules/default/views/scripts/auth/login.phtml
@@ -1,4 +0,0 @@
-<div class="formWrapper">
- <h2 class="formTitle"><?=$this->translate('sign_in');?></h2>
- <?= $this->loginForm; ?>
-</div>
View
4 application/modules/default/views/scripts/register/index.phtml
@@ -1,4 +0,0 @@
-<div class="formWrapper">
- <h2 class="formTitle"><?=$this->translate('register');?></h2>
- <?= $this->registerForm; ?>
-</div>
View
15 public/css/style.css
@@ -23,7 +23,7 @@ a:hover {
}
#pageWrap {
- margin: 20px auto;
+ margin: 0 auto 20px;
width: 980px;
}
@@ -33,12 +33,22 @@ a:hover {
/* -------------------------------------------------------------------------- */
#siteHeader {
+ background: #0B5394 url(/images/sprites/gradients.png) repeat-x left -120px;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
margin-bottom: 20px;
+ padding: 6px;
+ -moz-border-radius-bottomleft: 4px;
+ -moz-border-radius-bottomright: 4px;
+ -webkit-border-bottom-left-radius: 4px;
+ -webkit-border-bottom-right-radius: 4px;
}
#siteTitle {
+ color: #FFF;
font-size: 1.5em;
font-weight: bold;
+ text-shadow: -1px -1px 0 #0B5394;
}
#accountInfo {
@@ -62,8 +72,7 @@ a:hover {
/* -------------------------------------------------------------------------- */
#siteSearchForm {
- margin-top: 3px;
- margin-right: 12px;
+ margin-top: 2px;
}
#siteSearch {
Please sign in to comment.
Something went wrong with that request. Please try again.