Esempio n. 1
0
 public function validate_user($userdata)
 {
     $email = \Arr::get($userdata, 'email');
     if (!$this->has_user($email)) {
         Logger::instance()->log_log_in_attempt(Model_Log_In_Attempt::$ATTEMPT_NO_SUCH_USER, $email);
         throw new LogInFailed(\Lang::get('ethanol.errors.loginInvalid'));
     }
     $user = Model_User::find('first', array('related' => array('security', 'meta', 'groups'), 'where' => array(array('email', $email))));
     $password = \Arr::get($userdata, 'password');
     //Hash the given password and check that against the user
     $hashedPassword = Hasher::instance()->hash($password, $user->security->salt);
     if ($hashedPassword == $user->security->password) {
         $user->clean_security();
         return $user;
     }
     return false;
 }