diff --git a/www/protected/controllers/RegistroUsuarioController.php b/www/protected/controllers/RegistroUsuarioController.php
index 9f320d3..aac70ab 100644
--- a/www/protected/controllers/RegistroUsuarioController.php
+++ b/www/protected/controllers/RegistroUsuarioController.php
@@ -6,10 +6,7 @@
class RegistroUsuarioController extends Controller {
public $defaultAction = 'registrar';
-
- public function init() {
- $this->layout = '/layouts/mensajes';
- }
+ public $layout = '//layouts/error';
public function filters() {
return array('accessControl');
@@ -108,30 +105,42 @@ class RegistroUsuarioController extends Controller {
$usuario = Usuario::model()->findByAttributes(array('email' => $email));
// Comprobamos si se ha encontrado un usuario con ese email
- if (!isset($usuario))
- //$this->render('/user/message', array('title' => Yii::t("User activation"), 'content' => Yii::t("Incorrect activation URL.")));
- Yii::log("Incorrect activation URL. 3");
- elseif ($usuario->estado == Usuario::ESTADO_ACTIVO)
- //$this->render('/user/message', array('title' => Yii::t("User activation"), 'content' => Yii::t("You account is active.")));
- Yii::log("You account is active.");
- elseif ($usuario->estado == Usuario::ESTADO_DENEGADO)
- //$this->render('/user/message', array('title' => Yii::t("User activation"), 'content' => Yii::t("You account is banned.")));
- Yii::log("You account is banned.");
- elseif (isset($usuario->clave_seguridad) && ($usuario->clave_seguridad == $clave_seguridad)) {
+ if (!isset($usuario)) {
+ $this->render('//site/error', array(
+ 'titulo' => Yii::t('profind', 'Error de activación'),
+ 'mensaje' => Yii::t('profind', 'No se puede activar la cuenta.
La URL de activación es incorrecta.'),
+ ));
+ } elseif ($usuario->estado == Usuario::ESTADO_ACTIVO) {
+ $this->render('//site/error', array(
+ 'titulo' => Yii::t('profind', 'Cuenta ya activada'),
+ 'mensaje' => Yii::t('profind', 'No se ha realizado ningún cambio.
La cuenta ya estaba activada.'),
+ ));
+ } elseif ($usuario->estado == Usuario::ESTADO_DENEGADO) {
+ $this->render('//site/error', array(
+ 'titulo' => Yii::t('profind', 'Cuenta bloqueada'),
+ 'mensaje' => Yii::t('profind', 'La cuenta ha sido bloqueada.
Contacte con el administrador del sitio para obtener más información.'),
+ ));
+ } elseif (isset($usuario->clave_seguridad) && ($usuario->clave_seguridad == $clave_seguridad)) {
// Hay que activar el usuario
$usuario->estado = Usuario::ESTADO_ACTIVO;
$usuario->clave_seguridad = $usuario->encrypt(microtime());
$usuario->save();
+
$this->enviarMailConfirmacionActivacion($usuario);
- $this->render('confirmacion_usuario');
- Yii::log("You account is activated.");
+
+ $this->layout = '//layouts/mensaje';
+ $this->render('confirmacion_usuario', array());
} else {
- $this->render('error_confirmacion');
- Yii::log("Incorrect activation URL. 2 ");
+ $this->render('//site/error', array(
+ 'titulo' => Yii::t('profind', 'Error de activación'),
+ 'mensaje' => Yii::t('profind', 'No se puede activar la cuenta.
La URL de activación es incorrecta.'),
+ ));
}
} else {
- $this->render('error_confirmacion');
- Yii::log("Incorrect activation URL. 1");
+ $this->render('//site/error', array(
+ 'titulo' => Yii::t('profind', 'Error de activación'),
+ 'mensaje' => Yii::t('profind', 'No se puede activar la cuenta.
La URL de activación es incorrecta.'),
+ ));
}
}
@@ -151,9 +160,9 @@ class RegistroUsuarioController extends Controller {
$mensaje->subject = Yii::t('profind', 'Complete su registro en PROFIND');
$mensaje->view = 'registro_usuario';
$mensaje->setBody(array(
- 'url' => $url_activacion,
- 'email' => $usuario->email
- ), 'text/html'
+ 'url' => $url_activacion,
+ 'email' => $usuario->email
+ ), 'text/html'
);
Yii::app()->mail->send($mensaje);
@@ -173,10 +182,11 @@ class RegistroUsuarioController extends Controller {
$mensaje->subject = Yii::t('profind', 'Gracias por registrarse en PROFIND.');
$mensaje->view = 'confirmacion_usuario';
$mensaje->setBody(array(
- 'email' => $usuario->email
- ), 'text/html'
+ 'email' => $usuario->email
+ ), 'text/html'
);
Yii::app()->mail->send($mensaje);
}
+
}
\ No newline at end of file
diff --git a/www/protected/controllers/SiteController.php b/www/protected/controllers/SiteController.php
index 9689bfa..9d85c55 100644
--- a/www/protected/controllers/SiteController.php
+++ b/www/protected/controllers/SiteController.php
@@ -1,102 +1,96 @@
array('login'),
- 'users' => array('*')
- ),
- array('allow',
- 'users' => array('@')
- ),
- array('deny'),
- );
- }
-
- /**
- * This is the default 'index' action that is invoked
- * when an action is not explicitly requested by users.
- */
- public function actionIndex()
- {
- // renders the view file 'protected/views/site/index.php'
- // using the default layout 'protected/views/layouts/main.php'
- $this->render('index');
- }
+class SiteController extends Controller {
- /**
- * This is the action to handle external exceptions.
- */
- public function actionError()
- {
- if($error=Yii::app()->errorHandler->error)
- {
- if(Yii::app()->request->isAjaxRequest)
- echo $error['message'];
- else
- $this->render('error', $error);
- }
- }
+ public function filters() {
+ return array('accessControl');
+ }
- /**
- * Displays the login page
- */
- public function actionLogin()
- {
- $formulario = new FormularioLogin;
- $resultado = array();
+ public function accessRules() {
+ return array(
+ array('allow',
+ 'actions' => array('login'),
+ 'users' => array('*')
+ ),
+ array('allow',
+ 'users' => array('@')
+ ),
+ array('deny'),
+ );
+ }
- // if it is ajax validation request
- if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
- {
- $formulario->email = $_POST['FormularioLogin_email'];
- $formulario->password = $_POST['FormularioLogin_password'];
-
- if(!$formulario->validate()) {
- foreach($formulario->getErrors() as $campo => $error) {
- $resultado[$campo] = $error;
- }
- echo function_exists('json_encode') ? json_encode($resultado) : CJSON::encode($resultado);
- Yii::app()->end();
- }
-
- $identificacion = new IdentificacionUsuario($formulario->email, $formulario->password);
- $identificacion->authenticate();
-
- if ($identificacion->errorCode != IdentificacionUsuario::ERROR_NONE) {
- $resultado['password'] = Yii::t('profind', 'Email o contraseña incorrectos');
- echo function_exists('json_encode') ? json_encode($resultado) : CJSON::encode($resultado);
- Yii::app()->end();
- }
+ /**
+ * This is the default 'index' action that is invoked
+ * when an action is not explicitly requested by users.
+ */
+ public function actionIndex() {
+ // renders the view file 'protected/views/site/index.php'
+ // using the default layout 'protected/views/layouts/main.php'
+ $this->render('index');
+ }
- $duracion = 0;
- Yii::app()->user->login($identificacion, $duracion);
- Yii::app()->user->setReturnUrl($this->createUrl('usuario/modificar', array('id' => $identificacion->id)));
-
- $resultado['status'] = '200';
- $resultado['redirect'] = Yii::app()->user->returnUrl;
- echo function_exists('json_encode') ? json_encode($resultado) : CJSON::encode($resultado);
- Yii::app()->end();
- }
-
- $this->redirect(Yii::app()->params['frontpage']);
- }
+ /**
+ * This is the action to handle external exceptions.
+ */
+ public function actionError() {
+ if ($error = Yii::app()->errorHandler->error) {
+ if (Yii::app()->request->isAjaxRequest)
+ echo $error['message'];
+ else {
+ $this->layout = '/layouts/error';
+ $this->render('error_sistema', $error);
+ }
+ }
+ }
+
+ /**
+ * Displays the login page
+ */
+ public function actionLogin() {
+ $formulario = new FormularioLogin;
+ $resultado = array();
+
+ // if it is ajax validation request
+ if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
+ $formulario->email = $_POST['FormularioLogin_email'];
+ $formulario->password = $_POST['FormularioLogin_password'];
+
+ if (!$formulario->validate()) {
+ foreach ($formulario->getErrors() as $campo => $error) {
+ $resultado[$campo] = $error;
+ }
+ echo function_exists('json_encode') ? json_encode($resultado) : CJSON::encode($resultado);
+ Yii::app()->end();
+ }
+
+ $identificacion = new IdentificacionUsuario($formulario->email, $formulario->password);
+ $identificacion->authenticate();
+
+ if ($identificacion->errorCode != IdentificacionUsuario::ERROR_NONE) {
+ $resultado['password'] = Yii::t('profind', 'Email o contraseña incorrectos');
+ echo function_exists('json_encode') ? json_encode($resultado) : CJSON::encode($resultado);
+ Yii::app()->end();
+ }
+
+ $duracion = 0;
+ Yii::app()->user->login($identificacion, $duracion);
+ Yii::app()->user->setReturnUrl($this->createUrl('usuario/modificar', array('id' => $identificacion->id)));
+
+ $resultado['status'] = '200';
+ $resultado['redirect'] = Yii::app()->user->returnUrl;
+ echo function_exists('json_encode') ? json_encode($resultado) : CJSON::encode($resultado);
+ Yii::app()->end();
+ }
+
+ $this->redirect(Yii::app()->params['frontpage']);
+ }
+
+ /**
+ * Logs out the current user and redirect to homepage.
+ */
+ public function actionLogout() {
+ Yii::app()->user->logout();
+ $this->redirect(Yii::app()->homeUrl);
+ }
- /**
- * Logs out the current user and redirect to homepage.
- */
- public function actionLogout()
- {
- Yii::app()->user->logout();
- $this->redirect(Yii::app()->homeUrl);
- }
}
\ No newline at end of file
diff --git a/www/themes/profind/css/profind.css b/www/themes/profind/css/profind.css
index c680766..8245d8e 100644
--- a/www/themes/profind/css/profind.css
+++ b/www/themes/profind/css/profind.css
@@ -1334,4 +1334,57 @@ label, input, button, select, textarea, select, textarea, input[type="text"], in
.nav .dropdown-toggle:hover .caret {
opacity: 1;
filter: alpha(opacity=100);
-}
\ No newline at end of file
+}
+
+/* página de mensajes y errores */
+.message_page, .error_page {
+ background:#eee
+}
+.message_page, .message_page body, .message_page .message_box,
+.error_page, .error_page body, .error_page .error_box {
+ height:100%
+}
+.message_page h1, .message_page h2, .message_page h3, .message_page h4,
+.error_page h1, .error_page h2, .error_page h3, .error_page h4{
+ font-family: helvetica, arial, sans-serif;
+ line-height:1.1;
+ color: #067ead;
+ text-shadow: 2px 2px 0px rgba(255,255,255,.5), 4px 4px 0px rgba(0,0,0,.1);
+ margin-bottom:10px;
+ padding:40px 0 0 300px;
+}
+.message_page h1,
+.error_page h1 {
+ font-size: 52px;
+}
+.message_page h2,
+.error_page h2 {
+ font-size: 46px;
+}
+.message_page h3,
+.error_page h3 {
+ font-size: 40px;
+}
+.message_page h4,
+.error_page h4 {
+ font-size: 32px;
+}
+.message_page p,
+.error_page p {
+ color:inherit;
+ font-size:16px;
+ line-height:24px;
+ font-weight:200;
+ margin-left:300px;
+}
+.message_page .back_link,
+.error_page .back_link {
+ margin-left:300px;
+}
+.message_page .message_box,
+.error_page .error_box {
+ padding:0;
+ width:72%;
+ margin: 0 auto;
+}
+
diff --git a/www/themes/profind/views/layouts/error.php b/www/themes/profind/views/layouts/error.php
new file mode 100644
index 0000000..7746171
--- /dev/null
+++ b/www/themes/profind/views/layouts/error.php
@@ -0,0 +1,36 @@
+
+
+
- Gracias por registrarse en PROFIND.
- Su cuenta ha sido confirmada.
-
El equipo de PROFIND
- - \ No newline at end of file +pageTitle = Yii::t('profind', 'Gracias por registrarse en PROFIND'); ?> + + diff --git a/www/themes/profind/views/site/error.php b/www/themes/profind/views/site/error.php index 2d0e605..e8eda70 100644 --- a/www/themes/profind/views/site/error.php +++ b/www/themes/profind/views/site/error.php @@ -1,6 +1,7 @@ -pageTitle = "Error " . $code; ?> +pageTitle = $titulo; ?> + diff --git a/www/themes/profind/views/site/error_sistema.php b/www/themes/profind/views/site/error_sistema.php new file mode 100644 index 0000000..fa7318b --- /dev/null +++ b/www/themes/profind/views/site/error_sistema.php @@ -0,0 +1,7 @@ +pageTitle = "Error " . $code; ?> + +