I assume you are using the AuthenticatesAndRegistersUsers
trait in your controller.
The registration is carried by the postRegister()
method in that trait, which calls the login()
method after creating a new user.
You can override this method in your controller and call the login()
method only when the active
field is true
. So, your postRegister()
method will be something like:
public function postRegister(Request $request)
{
$validator = $this->registrar->validator($request->all());
if ($validator->fails())
{
$this->throwValidationException(
$request, $validator
);
}
$user = $this->registrar->create($request->all());
if ($request->get('active')) {
$this->auth->login($user);
}
return redirect($this->redirectPath());
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…