I've got the Kohana Auth up and running lovely except for one minor thing. Using the Model_User that extends Model_Auth_User, there are callbacks that are used for email not available and username not available. When logging in with correct username and wrong password, I get a username not available error, which is obvious because the user is trying to log in. Any way around this? I spose I could use JS to get round this since I'm using JSON for my error messages. Any idea?
My actual error is different: login.username.invalid. When my username is valid. My login controller:
class Controller_Login extends Controller_Main {
public function action_index(){
if ($_POST)
{
#Instantiate a new user
$user = ORM::factory('user');
#Check Auth
$status = $user->login($_POST);
#If the post data validates using the rules setup in the user model
if ($status)
{
#redirect to the user account
$json = array('redirect'=>'home');
$this->request->headers['Content-Type'] = 'application/json';
$this->request->response = json_encode($json);
}else
{
#Get errors for display in view
//encode errors here
$errors = $_POST->errors('login');
$this->request->headers['Content-Type'] = 'application/json';
$this->request->response = json_encode($errors);
}
}
}
}