Hi, it’s me again, for a problem into the FAL_front.php lib
In the login() function when you test if the user authentication is right and so redirect to the entry page, you do two redundant actions.If we correct this problem we will speed up the login process without loosing security….
its at the line 150.
if ($validation_response==TRUE && $this->CI->fal_validation->login_check($username_login, $password_login) && $this->CI->freakauth_light->login())
{
in fact into freakauth_light->login()
at line 442 you do:
$query = $this->CI->usermodel->getUserForLogin($username, $password);
and into fal_validation->login_check()
at line 70 and line 93 you do
$query = $this->CI->UserModel->getUserByUsername($username_login);
// and
$query = $this->CI->UserModel->getUserForLogin($username_login , $encrypted_password);
You do 3 database acces where we can have the same result with only 1 database accés.
The reason is that you have added the FAL_validation lib recently and you have thought that it should be better to stay into the validation process to output the ‘wrong user or password’ error message instead to use the flashmessage output by the freakauth_light->login()check and I agree with that.
And the order of the conditions into the FAL_front->login() function :
($validation_response==TRUE && $this->CI->fal_validation->login_check($username_login, $password_login) && $this->CI->freakauth_light->login())
skip the freakauth_light->login() call if the user or password are wrong but not if they are right.
So in the first case we do 2 databses Acces and in the second 3…..
My solution is to use freakauth_light->login() into fal_validation->login_check() and we always use one database access and if we concider that it could be useless to preserve the flashmessage into the freakauth_light->login()we could delete it????
I give you the new >fal_validation->login_check() function (very shorter) :
//Modification
//function login_check($username_login, $password_login)
function login_check()
{
if ($this->CI->freakauth_light->login())
{
return true;
}
else
{
//let's set the message
$this->login_error_message = this->_error_prefix.$this->CI->lang->line('FAL_invalid_username_password_message').$this->_error_suffix;
return false;
}
}
And in the FAL_front->login() function line 150 the conditions became:
//modification
//if ($validation_response==TRUE && $this->CI->fal_validation->login_check($username_login, $password_login))
if ($validation_response==TRUE && $this->CI->fal_validation->login_check())
And to finish you can delete the flash message from the freakauth_light->login() function…
That’s all