Laravel 5.3
を使用して小さなアプリを作成しています。私はLaravelのデフォルトのAuth
にユーザーのアクティベーションを(電子メールの確認で)適用しました。しかし、アカウントやユーザーが電子メールアドレスを確認して起動していないと、パスワードリセットリンクの送信を停止する方法が見つかりませんでした。現在、ユーザーがアカウントを作成し、パスワードリセットリンクを使用してログインできるメールアドレスを確認していない場合。パスワードを送信する前にユーザーが有効になっているかどうかを確認するパスワードを忘れた場合
この
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->nullable();;
$table->string('username')->unique();
$table->string('email')->unique();
$table->string('company')->nullable();;
$table->string('password');
$table->boolean('activated')->default(false);
$table->rememberToken();
$table->timestamps();
});
Schema::create('user_activations', function (Blueprint $table) {
$table->integer('user_id')->unsigned();
$table->string('token')->index();
$table->timestamp('created_at');
});
}
UPDATE 私は、以下の機能を更新することにより、それを実行しようとしました。しかし、それは5.3で
public function reset(Request $request)
{
if (!$request->activated) {
return redirect('/');
} else {
$this->validate($request, $this->rules(), $this->validationErrorMessages());
$response = $this->broker()->reset(
$this->credentials($request), function ($user, $password) {
$this->resetPassword($user, $password);
}
);
return $response == Password::PASSWORD_RESET
? $this->sendResetResponse($response)
: $this->sendResetFailedResponse($request, $response);
}
}
'アプリ\のHttp \認証\ PasswordController'をオーバーライドする機能があります。方法。私は正確に何を書かなければならないのか説明していただけますか? –
はい、5.3では 'ResetPasswordController'です。 'reset()'メソッドを 'ResetPasswords'特性からコピーして(私の答えの中のリンクをクリックして)コントローラーにコピーして変更する必要があります。 –
私は質問を更新しました。私が間違っていたものが私のために働いていないことを確認できますか? –