I'm trying to set login functionality at home.ctp
I have problem with error "Notice (8): Use of undefined constant -
assumed ' ' [APP/views/layouts/default.php, line 49]"
which from this code"<?php echo $form->create('User', array('action'
=> 'login')); ?>"
also after click "login" botton goes to user/login page.
I have created this function at users_controller.php but according to
this ex) http://book.cakephp.org/view/172/Authentication
I don't need to put anything since auth component takes care of it so
I'm getting error message that view file is missing.
How can I keep user stay home.ctp page if they fail to log in also
what is the problem of error message?
I have table called "Users" and login is email and pass
at my app_controller.php
====================================================
class AppController extends Controller {
var $components = array('Auth');
function beforeFilter() {
Security::setHash("md5");
$this->Auth->fields = array('username' => 'email', 'password' =>
'pass');
$this->Auth->loginAction = array('controller' => 'users',
'action'
=> 'login');
$this->Auth->loginRedirect = array('controller' => 'pages',
'action'
=> 'home');
$this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');//'/';
$this->Auth->loginError = 'Invalid e-mail / password
combination.
Please try again';
$this->Auth->authorize = 'controller';
}
}
====================================================
my pages_controller.php
====================================================
class PagesController extends AppController {
var $name = 'Pages';
var $helpers = array('Html', 'Form', 'Javascript');
var $uses = array('User');
function beforeFilter() {
$this->Auth->allow('display');
parent::beforeFilter();
}
function display() {
$path = func_get_args();
$count = count($path);
if (!$count) {
$this->redirect('/');
}
$page = $subpage = $title = null;
if (!empty($path[0])) {
$page = $path[0];
}
if (!empty($path[1])) {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title'));
$this->render(join('/', $path));
}
}
====================================================
home.ctp
====================================================
<?php
if ($session->check('Message.auth')) $session->flash('auth');
?>
<?php echo $form->create('User', array('action' => 'login')); ?>
<h4>会員ログイン</h4>
login:
<?=$form->input('User.email', array( 'maxlength'=>100,
'label' => false,
'div'=>false))?>
password:
<?=$form->input('User.pass', array( 'type'=>'password',
'maxlength'=>20,
'label' => false,
'div'=>false))?>
====================================================
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---