【发布时间】:2014-11-29 08:44:31
【问题描述】:
我有一个 Sentry 正在使用的名为“用户”的表,但是我删除了不需要的列,例如激活码和持久码等。
这是我的表的结构:
我正在尝试使用通过“Sentry::createUser()”创建的帐户登录,但是不断抛出“UserNotActivatedException”并阻止我登录。
这是我的登录代码:
public function postLogin() {
#Build login
if(!Input::has('email') || !Input::has('password')) {
return Response::json(['response' => 'Please enter an email address and a password!']);
}
try {
$credentials = [
'email' => Input::get('email'),
'password' => Input::get('password')
];
$user = Sentry::authenticate($credentials, false);
return Response::json(['response' => 'You have been logged in.']);
} catch(Cartalyst\Sentry\Users\LoginRequiredException $e) {
return Response::json(['response' => 'Please enter an email address!']);
} catch(Cartalyst\Sentry\Users\PasswordRequiredException $e) {
return Response::json(['response' => 'Please enter a password!']);
} catch(Cartalyst\Sentry\Users\WrongPasswordException $e) {
return Response::json(['response' => 'That account could not be found1!']);
} catch(Cartalyst\Sentry\Users\UserNotFoundException $e) {
return Response::json(['response' => 'That account could not be found2!']);
} catch(Cartalyst\Sentry\Users\UserNotActivatedException $e) {
return Response::json(['response' => 'That account could not be found3!']);
} catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
return Response::json(['response' => 'That account could has been suspended!']);
} catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
return Response::json(['response' => 'That account has been banned!']);
}
}
这是正在返回的响应:
有什么方法可以禁用 Sentry 中用户的激活检查?
【问题讨论】:
-
我没有尝试过,因为我的表中不存在“激活”列。
-
是的,我说我在原来的问题中改变了它。我要问的问题是如何删除激活码。
-
一种简单的方法是将表格放回原来的位置,并且简单地使用正确的方法创建/注册帐户,而无需按照文档中的上述说明进行激活。
标签: php mysql laravel authentication cartalyst-sentry