0

我有个问题。当我尝试登录我的应用程序时,我收到以下消息:

错误异常

数组到字符串的转换

回溯:

/(无关紧要)/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php

$dbDataCol = $this->dbOptions['db_data_col'];
$dbIdCol   = $this->dbOptions['db_id_col'];

try {
    $sql = "SELECT $dbDataCol FROM $dbTable WHERE $dbIdCol = :id";
    $stmt = $this->pdo->prepare($sql);
    $stmt->bindParam(':id', $id, \PDO::PARAM_STR);

    $stmt->execute();

我用来登录的一段代码:

public function postLogin()
{
    $rules = [
        'login'     =>  'required',
        'password'  =>  'required'
    ];
    
    $validator = Validator::make(Input::all(), $rules);
    
    if($validator->fails())
    {
        return Redirect::route('login')->withErrors($validator)->withInput();
    }
    else
    {
        $remember = (bool) Input::get('rememberMe', false);
        
        try
        {
            $user = Sentry::authenticate([
                'login'     =>  Input::get('login'),
                'password'  =>  Input::get('password')
            ], $remember);
            
            Session::flash('successes', array_merge((array) Session::get('successes'), ['Witaj, ' . $user->displayname]));
            return Redirect::intended(URL::route('home'));
        }
        catch(Cartalyst\Sentry\Users\WrongPasswordException $e)
        {
            $validator->errors()->add('login', 'Login lub hasło nieprawidłowe.');
            $validator->errors()->add('password', 'Login lub hasło nieprawidłowe.');
            
            return Redirect::route('login')->withErrors($validator)->withInput();
        }
        catch(Cartalyst\Sentry\Users\UserNotFoundException $e)
        {
            $validator->errors()->add('login', 'Login lub hasło nieprawidłowe.');
            $validator->errors()->add('password', 'Login lub hasło nieprawidłowe.');
            
            return Redirect::route('login')->withErrors($validator)->withInput();
        }
        catch(Cartalyst\Sentry\Users\UserNotActivatedException $e)
        {
            Session::flash('dangers', ['Konto nieaktywne. Kliknij na link, który dostałeś mailem. Jeśli go nie dostałeś, skontaktuj się z administratorem.']);

            return Redirect::route('login')->withErrors($validator)->withInput();
        }
        catch(Cartalyst\Sentry\Throttling\UserBannedException $e)
        {
            Session::flash(['dangers', 'Konto zablokowane. Skontaktuj się z administratorem.']);
            
            return Redirect::route('login')->withErrors($validator)->withInput();
        }
    }
}

我正在为 cookie 使用数据库驱动程序,只有在选中记住我时才会出现错误 ($remember = true)

4

2 回答 2

0

修复您的身份验证调用:

$user = Sentry::authenticate(array(
    'login'     =>  Input::get('login'),
    'password'  =>  Input::get('password')
), $remember);
于 2013-12-29T23:36:07.287 回答
0

通过将表格 4.1 降级到 4 来修复。我认为这是某种错误。

于 2014-01-06T20:02:48.587 回答