Удалить проверку активации учетной записи Sentry

У меня есть таблица с именем «users», которая используется Sentry, однако я удалил ненужные столбцы, такие как коды активации и постоянные коды и т. Д.

Это структура моей таблицы:
Таблица пользователей

Я пытаюсь войти в систему, используя учетную запись, созданную с помощью «Sentry :: createUser ()», однако «UserNotActivationException» продолжает выдаваться и не позволяет мне войти в систему.

Это мой код входа в систему:

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?

1

Решение

Я исправил ошибку, создав собственный класс User и установив переменную $ activ в значение true.
Класс пользователя:

use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use Cartalyst\Sentry\Users\Eloquent\User as SentryUserModel;

class User extends SentryUserModel implements UserInterface, RemindableInterface {

public $activated = true;

public function getAuthIdentifier() {
return $this->getKey();
}

public function getAuthPassword() {
return $this->password;
}

public function getRememberToken() {
return $this->remember_token;
}

public function setRememberToken($value) {
$this->remember_token = $value;
}

public function getRememberTokenName() {
return 'remember_token';
}

public function getReminderEmail() {
return $this->email;
}

}

Я также создал две новые миграции для добавления столбцов «persist_code» и «last_login» в мою таблицу:

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddLastLoginToUsersTable extends Migration {

public function up() {
Schema::table('users', function(Blueprint $table) {
$table->string('last_login')->nullable();
});
}

public function down() {
Schema::table('users', function(Blueprint $table) {
$table->dropColumn('last_login');
});
}

}use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddPersistCodeToUsersTable extends Migration {

public function up() {
Schema::table('users', function(Blueprint $table) {
$table->string('persist_code')->nullable();
});
}

public function down() {
Schema::table('users', function(Blueprint $table) {
$table->dropColumn('persist_code');
});
}

}
1

Другие решения

Других решений пока нет …