public function execute(&$value, &$error)
 {
     $username = $value;
     $password_field = $this->getParameterHolder()->get('password_field');
     $password = $this->getContext()->getRequest()->getParameter($password_field);
     $remember_field = $this->getParameterHolder()->get('remember_field');
     $remember = $this->getContext()->getRequest()->getParameter($remember_field);
     $user = avrPhpbbUser::getUserByUsername($username);
     // user exists?
     // password is ok?
     if ($user && avrPhpbbUser::checkPassword($user, $password)) {
         if (!avrPhpbbUser::isActivated($user)) {
             $error = $this->getParameterHolder()->get('activation');
             return false;
         }
         $this->getContext()->getUser()->signIn($user, $remember);
         return true;
     }
     $error = $this->getParameterHolder()->get('username_error');
     return false;
 }
 public function signInSymfony($user, $con = null)
 {
     if ($user->getUserId() == 1) {
         return;
     }
     // signin
     $this->setAttribute('user_id', $user->getUserId(), 'avrPhpbbSecurityUser');
     $this->setAuthenticated(true);
     // credentials
     $this->clearCredentials();
     $this->addCredential('user');
     $this->addCredentials(avrPhpbbUser::getModeratorGroups($user));
     // save last login
     $user->setUserLastvisit(time());
     $user->save($con);
 }