pengin
2011-08-07 20:42:50 UTC
Hello,
I have a very basic blog setup in CakePHP. It was built using the
tutorial on the Cookbook manual, so it is very similar. I tried to
add authentication to it, but I keep receiving the error "Login
failed. Invalid username or password." when trying to login.
In my PostsController, I added beforeFilter() function:
function beforeFilter() {
$this->Auth->allow('index'');
}
This is so that users can view my blog (only when you are logged in
can you post, edit, etc).
I have not created a custom AppController. Is this necessary? I only
have a Posts and Users Controller, but I figured even I specifically
define it in Posts, I don't really need it in AppController unless I
want it in all the controllers.
My UsersController is exactly the same as the example in the
Authentication section of the Cookbook:
class UsersController extends AppController {
var $name = 'Users';
var $components = array('Auth'); // Not necessary if declared in
your app controller
/**
* The AuthComponent provides the needed functionality
* for login, so you can leave this function blank.
*/
function login() {
}
function logout() {
$this->redirect($this->Auth->logout());
}
}
I added the user to the MySQL database (using phpMyAdmin). I manually
inserted the username and password (and I applied the SAH1 function to
the password). I didn't change any of the AuthComponent defaults, so
it should be encrypted using SAH1? Or am I misunderstanding?
Yet I am still receiving the login error. What could the problem be?
I have a very basic blog setup in CakePHP. It was built using the
tutorial on the Cookbook manual, so it is very similar. I tried to
add authentication to it, but I keep receiving the error "Login
failed. Invalid username or password." when trying to login.
In my PostsController, I added beforeFilter() function:
function beforeFilter() {
$this->Auth->allow('index'');
}
This is so that users can view my blog (only when you are logged in
can you post, edit, etc).
I have not created a custom AppController. Is this necessary? I only
have a Posts and Users Controller, but I figured even I specifically
define it in Posts, I don't really need it in AppController unless I
want it in all the controllers.
My UsersController is exactly the same as the example in the
Authentication section of the Cookbook:
class UsersController extends AppController {
var $name = 'Users';
var $components = array('Auth'); // Not necessary if declared in
your app controller
/**
* The AuthComponent provides the needed functionality
* for login, so you can leave this function blank.
*/
function login() {
}
function logout() {
$this->redirect($this->Auth->logout());
}
}
I added the user to the MySQL database (using phpMyAdmin). I manually
inserted the username and password (and I applied the SAH1 function to
the password). I didn't change any of the AuthComponent defaults, so
it should be encrypted using SAH1? Or am I misunderstanding?
Yet I am still receiving the login error. What could the problem be?
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe-/***@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe-/***@public.gmane.org For more options, visit this group at http://groups.google.com/group/cake-php