php - Laravel Auth Custom Fields -
trying add custom field auth, check if user 'activated' before allowing login
i've tried modifying authenticatesusers.php
although understand file shouldnt edited directly.
here tried , did not work.
public function postlogin(request $request) { $this->validate($request, [ $this->loginusername() => 'required', 'password' => 'required', 'activated' => '1' ]);
you can add custom field manaually authenticating users.
public function postlogin(request $request) { $this->validate($request, [ $this->loginusername() => 'required', 'password' => 'required' ]); if (auth::attempt(['email' => $request->email, 'password' => $request->password,'activated'=>1]) ) { return redirect()->intended('/'); } }
Comments
Post a Comment