Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- login

  • Loading branch information...
commit bc75d1949be32682f4a615c681aa644d2c661604 1 parent 893867e
matz authored
View
2  apps/frontend/config/frontendConfiguration.class.php
@@ -4,5 +4,7 @@ class frontendConfiguration extends sfApplicationConfiguration
{
public function configure()
{
+ sfValidatorBase::setDefaultMessage('required', 'Campo requerido.');
+ sfValidatorBase::setDefaultMessage('invalid', 'Inválido.');
}
}
View
12 apps/frontend/config/routing.yml
@@ -14,3 +14,15 @@ default_index:
default:
url: /:module/:action/*
+
+sf_guard_signin:
+ url: /login
+ param: { module: sfGuardAuth, action: signin }
+
+sf_guard_signout:
+ url: /logout
+ param: { module: sfGuardAuth, action: signout }
+
+sf_guard_password:
+ url: /request_password
+ param: { module: sfGuardAuth, action: password }
View
18 apps/frontend/modules/sfGuardAuth/templates/_signin_form.php
@@ -0,0 +1,18 @@
+<div>
+ <h1><?php echo __('Login') ?></h1>
+ <a href="<?php echo url_for('user/register') ?>" style="margin-right: 15px;">
+ <?php echo __('Se ainda não tens conta, regista-te aqui')?>
+ </a>
+</div>
+<div>
+ <form action="<?php echo url_for('@sf_guard_signin') ?>" method="post">
+ <table style="width: 100%">
+ <?php echo $form ?>
+ </table>
+ <div style="width: 60px; left: 350px; bottom: 25px; position: relative;">
+ <button type="submit">
+ <b><?php echo __('Entrar')?></b>
+ </button>
+ </div>
+ </form>
+</div>
View
9 apps/frontend/modules/sfGuardAuth/templates/secureSuccess.php
@@ -0,0 +1,9 @@
+<?php use_helper('I18N') ?>
+
+<h2><?php echo __('Oops! The page you have asked for is restricted and you cannot gain access without authorisation.', null, 'sf_guard') ?></h2>
+
+<p><?php echo sfContext::getInstance()->getRequest()->getUri() ?></p>
+
+<h3><?php echo __('Login below', null, 'sf_guard') ?></h3>
+
+<?php echo get_component('sfGuardAuth', 'signin_form') ?>
View
7 apps/frontend/modules/sfGuardAuth/templates/signinSuccess.php
@@ -0,0 +1,7 @@
+<style type="text/css">
+ table tr { height: 30px; text-align: left; }
+ table th { width: 25%; }
+</style>
+<div class="well">
+ <?php echo get_partial('sfGuardAuth/signin_form', array('form' => $form)) ?>
+</div>
View
51 apps/frontend/modules/user/actions/actions.class.php
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * user actions.
+ *
+ * @package museu
+ * @subpackage user
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
+ */
+class userActions extends sfActions
+{
+ /**
+ * Executes index action
+ *
+ * @param sfRequest $request A request object
+ */
+ public function executeIndex(sfWebRequest $request)
+ {
+ }
+
+ public function executeRegister(sfWebRequest $request)
+ {
+ $this->form = new sfGuardUserForm();
+ }
+
+ public function executeCreate(sfWebRequest $request)
+ {
+ $this->forward404Unless($request->isMethod(sfRequest::POST));
+
+ $this->form = new sfGuardUserForm();
+
+ $this->processForm($request, $this->form);
+
+ $this->setTemplate('register');
+ }
+
+ protected function processForm(sfWebRequest $request, sfForm $form)
+ {
+ $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
+
+ if ($form->isValid())
+ {
+ $sf_guard_user = $form->save();
+
+ $this->getUser()->setFlash('notice', sfContext::getInstance()->getI18N()->__('User created.'));
+
+ $this->redirect('@sf_guard_signin');
+ }
+ }
+}
View
0  apps/frontend/modules/user/templates/indexSuccess.php
No changes.
View
20 apps/frontend/modules/user/templates/registerSuccess.php
@@ -0,0 +1,20 @@
+<div class="well">
+ <div><h1><?php echo __('Registo') ?></h1></div>
+ <div>
+ <form method="post" action="<?php echo url_for('user/create') ?>" name="new_user" id="new_user">
+ <table style="width: 100%; text-align: left;">
+ <tfoot>
+ <tr>
+ <td colspan="2">
+ <?php echo $form->renderHiddenFields(false) ?>
+ <button type="submit"><b><?php echo __('Registar')?></b></button>
+ </td>
+ </tr>
+ </tfoot>
+ <tbody>
+ <?php echo $form ?>
+ </tbody>
+ </table>
+ </form>
+ </div>
+</div>
View
12 apps/frontend/templates/layout.php
@@ -12,7 +12,7 @@
<div class="container">
<div class="navbar">
<div class="row-fluid">
- <img src="images/banner.png" style="width: 100%; margin-top: 5px;"/>
+ <img src="/images/banner.png" style="width: 100%; margin-top: 5px;"/>
</div>
<div class="navbar-inner">
@@ -25,12 +25,12 @@
<span class="brand"><?php echo __('Bem vindo') ?></span>
<div class="nav-collapse">
<ul class="nav">
- <li id="home"><a href="./"><?php echo __('Home') ?></a></li>
- <li id="catalogo"><a href="catalogo"><?php echo __('Catálogo') ?></a></li>
- <li id="visita"><a href="visita"><?php echo __('Visita Guiada') ?></a></li>
- <li id="contact"><a href="contact"><?php echo __('Contactos') ?></a></li>
+ <li id="home"><a href="<?php echo url_for('@homepage') ?>"><?php echo __('Home') ?></a></li>
+ <li id="catalogo"><a href="<?php echo url_for('catalogo/index') ?>"><?php echo __('Catálogo') ?></a></li>
+ <li id="visita"><a href="<?php echo url_for('visita/index') ?>"><?php echo __('Visita Guiada') ?></a></li>
+ <li id="contact"><a href="<?php echo url_for('contacto/index') ?>"><?php echo __('Contactos') ?></a></li>
</ul>
- <p class="navbar-text pull-right"><a href="layout"><?php echo __('Entrar/Registar') ?></a></p>
+ <p class="navbar-text pull-right"><a href="<?php echo url_for('@sf_guard_signin') ?>"><?php echo __('Entrar/Registar') ?></a></p>
</div><!--/.nav-collapse -->
</div>
</div>
View
28 lib/form/doctrine/sfGuardUserForm.class.php
@@ -1,5 +1,5 @@
<?php
-
+sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');
/**
* sfGuardUser form.
*
@@ -12,5 +12,31 @@ class sfGuardUserForm extends BasesfGuardUserForm
{
public function configure()
{
+ $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
+ $this->widgetSchema['password_again'] = new sfWidgetFormInputPassword();
+
+ $this->validatorSchema['password_again'] = clone $this->validatorSchema['password'];
+
+ $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => __('A password deve coincidir.'))));
+
+ unset(
+ $this['algorithm'],
+ $this['salt'],
+ $this['is_active'],
+ $this['is_super_admin'],
+ $this['last_login'],
+ $this['created_at'],
+ $this['updated_at'],
+ $this['groups_list'],
+ $this['permissions_list']
+ );
+
+ $this->widgetSchema->setLabels(array(
+ 'first_name' => __('Primeiro Nome'),
+ 'last_name' => __('Último Nome'),
+ 'email_address' => __('Email'),
+ 'username' => __('Username'),
+ 'password_again' => __('Reescreva a Password')
+ ));
}
}
View
6 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/sfGuardFormSignin.class.php
@@ -1,5 +1,5 @@
<?php
-
+sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');
/**
* sfGuardFormSignin for sfGuardAuth signin action
*
@@ -15,5 +15,9 @@ class sfGuardFormSignin extends BasesfGuardFormSignin
*/
public function configure()
{
+ $this->widgetSchema->setLabels(array(
+ 'username' => __('Username/Email'),
+ 'remember' => __('Lembrar?')
+ ));
}
}
View
19 test/functional/frontend/defaultActionsTest.php
@@ -0,0 +1,19 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+$browser = new sfTestFunctional(new sfBrowser());
+
+$browser->
+ get('/default/index')->
+
+ with('request')->begin()->
+ isParameter('module', 'default')->
+ isParameter('action', 'index')->
+ end()->
+
+ with('response')->begin()->
+ isStatusCode(200)->
+ checkElement('body', '!/This is a temporary page/')->
+ end()
+;
View
19 test/functional/frontend/sfGuardAuthActionsTest.php
@@ -0,0 +1,19 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+$browser = new sfTestFunctional(new sfBrowser());
+
+$browser->
+ get('/sfGuardAuth/index')->
+
+ with('request')->begin()->
+ isParameter('module', 'sfGuardAuth')->
+ isParameter('action', 'index')->
+ end()->
+
+ with('response')->begin()->
+ isStatusCode(200)->
+ checkElement('body', '!/This is a temporary page/')->
+ end()
+;
View
19 test/functional/frontend/userActionsTest.php
@@ -0,0 +1,19 @@
+<?php
+
+include(dirname(__FILE__).'/../../bootstrap/functional.php');
+
+$browser = new sfTestFunctional(new sfBrowser());
+
+$browser->
+ get('/user/index')->
+
+ with('request')->begin()->
+ isParameter('module', 'user')->
+ isParameter('action', 'index')->
+ end()->
+
+ with('response')->begin()->
+ isStatusCode(200)->
+ checkElement('body', '!/This is a temporary page/')->
+ end()
+;
View
13 web/css/main.css
@@ -3494,4 +3494,17 @@ to {
}
.invisible {
visibility: hidden;
+}
+.error_list{
+ color: red;
+ font-weight: normal;
+ color: red;
+ text-align: left;
+ padding-left: 25px;
+ padding-top: 5px;
+ padding-bottom: 5px;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ background: transparent url(/images/icons/error.png) no-repeat scroll left;
+ border: 1px solid #D46363;
}
View
BIN  web/images/icons/error.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.