Reputation: 49
I am using users table column name (EMAIL,PASSWORD).if i am changing to column name(email) as small letters is working fine. To Change column name(EMAIL) as caps is not working give me any suggestion. i am able to login but forget password is not working. please give any suggestion
my function in controller:
public function postEmail(Request $request)
{
$this->validate($request, array('email' => 'required|email'));
$response = $this->passwords->sendResetLink($request->only('EMAIL'), function ($m) {
$m->subject($this->getEmailSubject());
});
switch ($response) {
case PasswordBroker::RESET_LINK_SENT:
return redirect()->back()->with('status', trans($response));
case PasswordBroker::INVALID_USER:
return redirect()->back()->withErrors(array('email' => trans($response)));
}
}
I am getting this error in the page:
QueryException in Connection.php line 624:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'email' cannot be null (SQL: insert into `password_resets` (`email`, `token`,`created_at`)
values (, 5d2b40143e084824402984c81cdfaa64264328bdc9c6d73cf80e1a1aa773d0cc, 2016-07-29 09:52:40))
Upvotes: 1
Views: 921
Reputation: 40919
Email field in your form is called EMAIL so your validation will fail, as it checks for existence of email field in the request.
For the start, replace
$this->validate($request, array('email' => 'required|email'));
with
$this->validate($request, array('EMAIL' => 'required|email'));
and let me know if it already works or there are some other errors and I'll update the answer with next steps. Be sure to post the error you're getting.
In order to store password reset tokens you need to tell Laravel how to retrieve user's email. You can do that by adding the following method to your User model:
public function getEmailForPasswordReset()
{
return $this->EMAIL;
}
Upvotes: 1